Wano Developer Meetup Vol.3

Wano Developer Meetup Vol.3

641b42a79e646b90c9d6a30d5bc1911a?s=128

ShingoYadomoto

December 04, 2019
Tweet

Transcript

  1. ָۂγΣΞػೳͷ ύϑΥʔϚϯεվળ

  2. Profile ॓ຊ ਅޗ TuneCore Japan Web Engineer Perl, Go, etc

  3. ࿩͢͜ͱ • ઌ೔ى͖ͨ໰୊ΛͲ͏ղܾ͔ͨ͠ • ࣮૷ͷมߋɾPerl —> Go ҠߦʹΑΔύϑΥʔϚϯε্ঢ౓

  4. None
  5. None
  6. None
  7. 2019-12-14 00:00 Ҏ߱ʹΞΫηε͢Δͱ

  8. None
  9. LinkCore • ֤഑৴ετΞͷURL͕ҰׅγΣΞՄೳ • ୭͕ɾͲͷετΞͰ౳ͷ౷ܭσʔλΛӾཡՄೳ

  10. ʂʂWarningʂʂ

  11. None
  12. None
  13. None
  14. None
  15. ى͖ͨ໰୊ • SNSͰ֦ࢄ్ͨ͠୺ʹΞΫηεूத • 30෼ఔAppαʔόʔͷCPU࢖༻཰͕MAXʹ…

  16. ରࡦ͍ͯ͠ͳ͔ͬͨʁ

  17. چରࡦ • CDN • AMP • DBΩϟογϡ

  18. ໰୊఺ • CDN • AMP • DBΩϟογϡ ഑৴೔ͷ00:00Ҏ߱ΩϟογϡΛߋ৽͠ͳ͍ͱ͍͚ͳ͍ —> Ωϟογϡͷ఻೻͕ؒʹ߹Θͳ͍

    ϝδϟʔͳϦϦʔε͸ࡹ͖੾Εͳ͍ +α: ඇಉظͰ౷ܭ৘ใΛDBʹอଘ
  19. ΞϓϦέʔγϣϯଆͰରࡦΛUpdate͢Δ͜ͱʹ

  20. ৽ରࡦ GET: ϖʔδදࣔ —> ༗ޮظݶ෇͖ͰHTMLΛDBʹΩϟογϡ hashͷΩϟογϡΛ࢖༻ POST: ౷ܭσʔλ —> อଘઌΛDB͔ΒϑΝΠϧʹมߋ

    ౷ܭσʔλΛҰ࣌తʹRDBʹอଘ
  21. ϦΫΤετ DBʹอଘ detailςʔϒϧͷ৘ใΛsummaryςʔϒϧʹอଘʢcronʣ Insert Select ᶃ ᶄ

  22. ϦΫΤετ ϑΝΠϧʹอଘ ϑΝΠϧͷ৘ใΛsummaryςʔϒϧʹอଘʢcronʣ Write Read ᶃ ᶄ

  23. ʢ৽ରࡦʣ Perl΍ΊΔ

  24. Benchmark • App(PerlɾGO) : Ubuntu • DB : mysql ؀ڥ

    Docker macOS Mojave $ ab -n 500 -c 50 • ૯ϦΫΤετ਺: 500 • ಉ࣌઀ଓ਺: 50 • ฏۉϨΠςϯγͷΈूܭ Apache Bench πʔϧ
  25. Benchmark 1. hashΩϟογϡ 2. HTMLΩϟογϡ 3. hashΩϟογϡ 4. HTMLΩϟογϡ Perl

    Go GET: ϖʔδදࣔ
  26. Benchmark ݁Ռ: GET ϨΠςϯγ hashΩϟογϡ(P) 117.7ms HTMLΩϟογϡ(P) 29.0ms HTMLΩϟογϡ(G) 1.5ms

  27. Benchmark ݁Ռ: GET ϨΠςϯγ hashΩϟογϡ(P) 117.7ms HTMLΩϟογϡ(P) 29.0ms HTMLΩϟογϡ(G) 1.5ms

    ×4.0 ×19.3
  28. Benchmark ݁Ռ: GET ϨΠςϯγ hashΩϟογϡ(P) 117.7ms HTMLΩϟογϡ(P) 29.0ms HTMLΩϟογϡ(G) 1.5ms

    ×78.5
  29. Benchmark ݁Ռ: GET hash(P) HTML(P) HTML(G) 0 30 60 90

    120
  30. Benchmark 1. DBʹอଘ 2. ϑΝΠϧʹอଘ 3. DBʹอଘ 4. ϑΝΠϧʹอଘ Perl

    Go POST: ౷ܭσʔλ
  31. Benchmark ݁Ռ: POST ϨΠςϯγ To DB(P) 32.2ms To File(P) 27.9ms

    To DB(G) 4.2ms To File(G) 2.9ms
  32. Benchmark ݁Ռ: POST ϨΠςϯγ To DB(P) 32.2ms To File(P) 27.9ms

    To DB(G) 4.2ms To File(G) 2.9ms ×1.2 ×1.4
  33. Benchmark ݁Ռ: POST ϨΠςϯγ To DB(P) 32.2ms To DB(G) 4.2ms

    To File(P) 27.9ms To File(G) 2.9ms ×7.7 ×9.6
  34. Benchmark ݁Ռ: POST ϨΠςϯγ To DB(P) 32.2ms To File(P) 27.9ms

    To DB(G) 4.2ms To File(G) 2.9ms ×11.1
  35. Benchmark ݁Ռ: GET To DB(P) To File(P) To DB(G) To

    File(G) 0 10 20 30 40
  36. ·ͱΊ • ࣮૷มߋͰGET:4ഒɾPOST: 1~2ഒ΄Ͳվળ • ݴޠมߋͰGET:19ഒɾPOST: 7~9ഒ΄Ͳվળ • ࠷ऴతʹGET:78ഒɾPOST: 11ഒ΄Ͳվળ

  37. • DB΁ͷอଘͱϑΝΠϧ΁ͷॻ͖ࠐΈ͸༧૝ΑΓ΋଎౓͕ มΘΒͳ͔ͬͨ • Perl to Go ੌ·͍͡

  38. None