Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Go at fluct

9c47f639b91a66ccf901724eaaf9043d?s=47 Kenta Suzuki
November 18, 2020
700

Go at fluct

Nature Bath vol.6での発表資料です

9c47f639b91a66ccf901724eaaf9043d?s=128

Kenta Suzuki

November 18, 2020
Tweet

Transcript

  1. Go at fluct Nature Bath vol.6 #naturebath, 2020/11/18 @suzu_v

  2. ࣗݾ঺հ ླ໦݈ଠ, ͚ͣ͢Μ (Twitter: @suzu_v) גࣜձࣾfluct औక໾CTO ΈΜͳͷGoݴޠ ڞஶऀ ࠷ۙ͸TypeScriptͱPHPͱYAMLΛΑ͘ॻ͍͍ͯ·͢

  3. fluctͰͷGoར༻ -2015: PHP, Perl, Erlang͕ϝΠϯ 2015೥͘Β͍͔ΒঃʑʹαϒγεςϜ͔Βར༻։࢝ ݱঢ়Ͱ͸ෳ਺ͷϓϩμΫγϣϯϫʔΫϩʔυʹ࢖ΘΕ͍ͯΔ cliπʔϧɺdebuggerɺAPIαʔόɺόον... ࠓ೔͸3ͭͷࣄྫΛ঺հ͠·͢

  4. ௿ϨΠςϯγͱ҆ఆੑΛੜΉΞʔΩςΫ νϟ - SSPͷݱ৔ʹֶͿɺߴՄ༻ੑͷͭ͘ Γํ: ΤϯδχΞHub https://eh-career.com/engineerhub/entry/ 2019/07/12/103000

  5. ࣄྫ1: PHP -> Go ݩʑ: ޿ࠂ഑৴ϩάΛग़ྗ͢Δαʔό Apache + PHP ໾ׂ:

    ഑৴ύϥϝʔλͷ෮߸ɺϩάग़ྗʢ੥ٻ & ؂ࢹ༻ʣ // PHP -> Apache (custom log module) -> log apache_setenv(F_ENV_NAME_STATUS, $status); Testability௿͍, Apacheͳ͍ͱखݩͰࢼͤͳ͍ -> ϦϓϨʔε
  6. PHP -> Go: ςετ༰қੑͱҠ২ TestMain ͰPHP + ApacheίϯςφͱGoίϯςφΛ্ཱͪ͛ ֤ςετέʔεͰϓϩμΫγϣϯͱಉ༷ͷύϥϝʔλΛ࣮ࡍʹ౤͛Δ ग़ྗ͞ΕΔϩά͕PHP

    + Apache࣮૷ͱGo࣮૷ͰಉҰͰ͋Δ͜ͱΛࢼݧ ҉߸ԽɺloggerɺWeb API·ΘΓΛGoʹҠ২ & ֤ػೳΛpackageԽ
  7. ࣄྫ2: Open Bidding΁ͷ઀ଓ Google Ad Managerʹbidderͱͯ͠઀ଓ @tomita τϛʔϧ͞Μ͕։ൃ Open Biddingͱ͸

    ͻͱ͜ͱͰ: Google͔Β޿ࠂϦΫΤετΛड෇͚ɺͦΕΛDSPsʹϦΞϧλΠϜʹΦʔΫγϣϯ͠ɺ޿ࠂΛฦ ͢࢓૊Έʢ͢΂ͯαʔόؒ௨৴ʣ ϝσΟΞ <- Google <-> bidder (fluct) <-> DSPs GoͰ࣮૷ʢRTBαʔϏε͸Erlang࣮૷Λར༻ʣ 30ԯʙ req. / day ϚϧνΫϥ΢υʢAWS, GCPʣɺϚϧνϦʔδϣϯ എܠ: ଟ༷ͳϦΫΤετɺεϧʔϓοτॏࢹɺطଘαʔϏεΛ͏·͘࢖͍ճ͢
  8. ࣄྫ2: Open Bidding΁ͷ઀ଓ (cont.) https://www.youtube.com/watch?v=uE0ReWlYbNk

  9. ࣄྫ3: romdb 2010- memcachedb + Berkeley DB forkͨ͠memcachedbʢC++੡ʣͷϏϧυ͕ͭΒ͍ Berkeley DBΛஈ֊తʹஔ͖׵͍͖͍͑ͯͨ

    -> memcachedb෦ΛGoʹஔ͖׵͑
  10. ࣄྫ3: romdb (cont.) @yowcow ͕GoͰϦϓϨʔε https://github.com/yowcow/goromdb storage૚ͷࠩ͠ସ͕͑Մೳ: Berkeley DB, BoltDB,

    JSON etc. ಛఆσΟϨΫτϦʹ͓͘ͱstorageΛࠩ͠ସ͑ΒΕΔ (memcachedbͱಉ༷ʣ ϓϩτίϧ΋ෳ਺ରԠՄೳʢmemcached, etc.ʣ ຊ൪؀ڥͰ͸BoltDBͱBerkeley DBΛซ༻
  11. ·ͱΊ • ͍ΖΜͳਓ͕ͳΜ͔ͩΜͩGoΛ৮͍ͬͯΔ • ϓϩμΫτͷ伱ؒɺͪΐͬͱϏϧυɾςετΛ͠΍͍ͨ͘͢͠ ͱ͖ʹGo͕ͪΐ͏Ͳ͍͍