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

GoogleAppEngineのマルチテナント機能の活用事例

A033e4e5869cc7b4f7601f3b0d5e6e4b?s=47 kurikei
September 25, 2018

 GoogleAppEngineのマルチテナント機能の活用事例

A033e4e5869cc7b4f7601f3b0d5e6e4b?s=128

kurikei

September 25, 2018
Tweet

More Decks by kurikei

Other Decks in Technology

Transcript

  1. GoogleAppEngineͷマルチ テナントػೳͷ׆༻ࣄྫ DeSCϔϧεέΞגࣜձࣾ ϔϧεέΞサービス։ൃάϧʔϓ ܀ాՂ༞

  2. ࣗݾ঺հ •  ໊લ •  ܀ాՂ༞ •  αʔόʔαΠυΤϯδχΞ •  Perl, Ruby,

    Go … •  ܦྺ •  2012.04ʙ DeNAೖࣾ •  2012.09ʙ ήʔϜࣄۀ෦ͰιʔγϟϧήʔϜͷ։ൃ •  2015.10ʙ DeSCϔϧεέΞ΁ҟಈ 2
  3. アジェンダ •  DeSCϔϧεέΞͰ։ൃ͍ͯ͠ΔαʔϏε঺հ •  ར༻͍ͯ͠ΔGCPͷαʔϏε •  GAEͷϚϧνςφϯτػೳͷ׆༻ྫ 3

  4. DeSCϔϧεέΞͰ։ൃ͍ͯ͠ΔαʔϏε 4 KenCoM ߦಈม༰αʔϏε܈

  5. DeSCϔϧεέΞͰ։ൃ͍ͯ͠ΔαʔϏε 5 KenCoM •  ݈߁อݥͷ૊߹һ޲͚αʔϏε •  ݈߁਍அͷ݁Ռ΍ҩྍඅͳͲ͕ݟΕΔ •  KenCoMར༻ऀ͸ར༻ͯ͠ͳ͍ਓΑΓ ੜ׆श׳පͷጶױϦεΫ͕ɺ౷ܭతʹ

    ௿͍͜ͱ͕Θ͔ͬͨ •  ΦϯϓϨ؀ڥ ʢLinux, nginx, Rails etcʣ
  6. DeSCϔϧεέΞͰ։ൃ͍ͯ͠ΔαʔϏε 6 ߦಈม༰αʔϏε܈ •  αʔϏεΛར༻͢Δ͜ͱͰϢʔβʔͷ ߦಈΛม༰ͤ͞ɺΑΓ݈߁ʹͳͬͯ΋ Β͏ͨΊͷαʔϏε •  caminaru ͸ϦϦʔεࡁΈ

    •  ೔ʑͷา਺ͷ໨ඪΛୡ੒ͨ͠ΒΪ ϑτ͕΋Β͑ΔαʔϏε •  ผͷ੾ΓޱͰαʔϏεΛ։ൃத •  GCPΛར༻
  7. ओʹར༻͍ͯ͠ΔGCPͷαʔϏε 用途 GCPαʔϏε ΞϓϦέʔγϣϯ Google AppEngine StandardɿGo ʢAPIαʔόʔʣ Flexibleɿ Ruby

    / Rails ʢ؅ཧπʔϧʣ Flexibleɿ Ruby /sinatra ʢΞϓϦͷOTA഑෍༻αΠτʣ σʔλετΞ Cloud Datastore ϩά؂ࢹɾϝτϦΫε StackDriver {Logging, Monitoring …} σʔλ΢ΣΞϋ΢ε BigQuery BIπʔϧ Cloud Datastudio 7
  8. AppEngineͷબఆཧ༝ •  ϑϧϚωʔδυ •  ΞϓϦέʔγϣϯΛσϓϩΠ͢Δ͚ͩ •  ਓ਺͕গͳ͍νʔϜͳͷͰɺͳΔ͚ͩΞϓϦέʔγϣϯͷ։ൃʹ஫ྗͨ͠ ͍ •  FaaSΑΓ΋ॊೈͰෳࡶͳ͜ͱ͕Ͱ͖Δ

    •  Ϛϧνςφϯτػೳʢޙड़ʣͰ෼཭ͨ͠ෳ਺ͷΞϓϦέʔγϣϯΛߏஙͰ͖Δ •  DeSCϔϧεέΞ͕͜Ε͔Β࡞Δߦಈม༰αʔϏεͷ੾Γޱ •  վળ͍݈ͨ͠߁ɾӡಈʹؔ͢Δࢦඪ ʢา਺ / ମॏ / ݂ѹ / ݈߁਍அ݁Ռ etcʣ •  αʔϏε࢖͍ଓ͚ΔͨΊͷཁૉ ʢΠϯηϯςΟϒ / ήʔϛϑΟέʔγϣϯ / ίϛϡχςΟ etcʣ •  ༷ʑͳ੾Γޱͷ͏ͪɺ݈߁ʹର͢ΔΠϯύΫτ͕ߴ͘ɺޮՌ͕ग़ͦ͏ͳ αʔϏε͔ΒॱʹϦϦʔε͍ͯ͘͠ઓུʹద͍ͯͨ͠ 8
  9. GoogleAppEngineͷϚϧνςφϯτػೳ •  1ͭͷϓϩδΣΫτ಺ʹෳ਺ͷΞϓϦέʔγϣϯΛߏஙͰ͖Δ •  ϚΠΫϩαʔϏεతͳ࢖͍ํ΋Ͱ͖Δ •  αʔϏεɾόʔδϣϯΛར༻͢Δ͜ͱͰΞϓϦέʔγϣϯίʔυͷ෼ ཭Λ࣮ݱʢޙड़ʣ •  ໊લۭؒΛઃఆ͢Δ͜ͱͰσʔλͷ෼཭Λ࣮ݱʢޙड़ʣ

    9 https://cloud.google.com/appengine/docs/standard/go/multitenancy
  10. ϚϧνςφϯτػೳɹʙαʔϏεɾόʔδϣϯʙ •  αʔϏεͱόʔδϣϯ •  ΞϓϦέʔγϣϯίʔυͷ෼཭͕Ͱ͖Δ •  1ϓϩδΣΫτʹෳ਺ͷαʔϏεΛɺ1αʔϏεʹෳ਺ͷόʔδϣ ϯ͕࡞Δ͜ͱ͕Ͱ͖Δ •  ΞϓϦέʔγϣϯ͝ͱʹผͷαʔϏεʹׂΓ౰ͯΔ͜ͱͰෳ਺ͷ

    ΞϓϦέʔγϣϯΛߏஙͰ͖Δ 10 ※ https://cloud.google.com/appengine/docs/standard/go/microservices-on-app-engine ΑΓҾ༻
  11. Ϛϧνςφϯτػೳɹʙ໊લۭؒʙ •  ໊લۭؒ •  σʔλͷ෼཭͕Ͱ͖Δ •  ΞϓϦέʔγϣϯ͝ͱʹ໊લۭؒΛઃఆ͢Δ͜ͱͰผΞϓϦͷ σʔλ͕ࢀরͰ͖ͳ͘ͳΔ •  σʔλ࿙ӮΛ๷͙ͨΊͷ࢓૊ΈͷҰͭ

    •  ѻ͏σʔλʹΑͬͯΑΓڧݻͳ෼཭͕ඞཁʹͳΔ͜ͱ΋͋Δͷ ͰηΩϡϦςΟཁ݅ʹԠͯ͡࢖͍෼͚Δඞཁ͸͋Δ •  Datastore, Memcached, TaskQueueͳͲ͕ରԠ͍ͯ͠Δ 11
  12. DeSCͰͷϚϧνςφϯτͷ׆༻ྫ ΞϓϦέʔγϣϯ αʔϏε ໊લۭؒ ΞϓϦAͷAPI serviceA-api serviceA ΞϓϦBͷAPI serviceB-api serviceB

    ※ಉ͡σʔλΛࢀর ΞϓϦBͷ؅ཧπʔϧ serviceB-admin 12 serviceA-api serviceB-api serviceB-admin σʔλͷ෼཭ ❌ ❌
  13. DeSCͰͷϚϧνςφϯτͷ׆༻ྫ 13 •  ΞϓϦέʔγϣϯAͱΞϓϦέʔγϣϯBͰผͷ໊લۭؒΛઃఆ •  ͦΕͧΕͷΞϓϦ͔Βଞํͷσʔλ͸ࢀরͰ͖ͳ͍ •  ΞϓϦBͷAPIͱ؅ཧπʔϧ͸໊લۭ͕ؒಉ͡ͳͷͰಉ͡σʔλΛࢀরɾฤू ͕Ͱ͖Δ

  14. ։ൃ༻ϓϩδΣΫτͰͷϚϧνςφϯτػೳͷར༻ αʔϏε (=ϦϙδτϦ) ϒϥϯν όʔδϣϯ ໊લۭؒ serviceA-api master master serviceA

    feature/auth feature-auth serviceA-feature-auth hotfix/db-err hotfix-db-err serviceA-hotfix-db-err 14 serviceA- feature-auth serviceA serviceA- hotfix-db-err master feature-auth hotfix-db-err
  15. ։ൃ༻ϓϩδΣΫτͰͷϚϧνςφϯτػೳͷར༻ 15 •  ϒϥϯνΛPush͢ΔͱCIπʔϧ͕ϒϥϯν໊ʹԠͨ͡όʔδϣϯΛ੾ͬͯ഑ ෍ͨ͠ •  AppEngineͰ͸ ֤αʔϏε/֤όʔδϣϯ͝ͱʹURL͕ൃߦ͞ΕΔͷͰɺ։ൃ ൛ΞϓϦͷϦΫΤετઌΛม͑Δ͜ͱͰ෼཭͞Εͨ؀ڥʹΞΫηε͕࡞੒Ͱ͖ Δ

    •  QAݕূ༻ͷ؀ڥ͕༰қʹ४උͰ͖Δ •  ຊ൪ͱεϖοΫతʹಉ౳ͷ؀ڥ΋४උͰ͖ΔͷͰɺຊ൪ݻ༗ͷΤϥʔͷௐ ࠪ΍ͦͷղফɺෛՙࢼݧͳͲ΋͠΍͍͢
  16. ·ͱΊ 16 •  GAEΛ࢖͏͜ͱͰΞϓϦέʔγϣϯͷ։ൃʹ஫ྗͰ͖Δ •  ϚϧνςφϯτػೳͰෳ਺ͷΞϓϦΛਝ଎ʹߏஙͰ͖ΔͷͰεϞʔϧελʔτ ʹ΋͏͚ͬͯͭ •  όʔδϣϯɾ໊લۭؒΛར༻͢Δ͜ͱͰಛఆͷ৚݅ͷ؀ڥΛ؆୯ʹߏஙͰ͖Δ ͷͰຊ൪؀ڥݻ༗ͷΤϥʔͷಉఆɾղফʹศར