Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Google App Engine を利用した、新規 Web サービスの立ち上げ方
Search
Osamu TONOMORI
August 20, 2017
Technology
23
8.2k
Google App Engine を利用した、新規 Web サービスの立ち上げ方
TECH PLAY Conference 2017 - クラウド最先端技術
#techplayconf2017 #techplayjp
Osamu TONOMORI
August 20, 2017
Tweet
Share
More Decks by Osamu TONOMORI
See All by Osamu TONOMORI
About Merpay Architect Team 2021
osamingo
0
1.6k
Gopher's Travel Journal 2018
osamingo
1
1.8k
Go のライブラリやっていき 💪 #go #golang / Let's creating a original library by Go
osamingo
3
1.9k
GAE/Go の勘どころ
osamingo
10
4.9k
Go で始める JSON-RPC 入門
osamingo
4
55k
Other Decks in Technology
See All in Technology
祝!Iceberg祭開幕!re:Invent 2024データレイク関連アップデート10分総ざらい
kniino
3
300
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
110
オプトインカメラ:UWB測位を応用したオプトイン型のカメラ計測
matthewlujp
0
180
Qiita埋め込み用スライド
naoki_0531
0
5.1k
第3回Snowflake女子会_LT登壇資料(合成データ)_Taro_CCCMK
tarotaro0129
0
190
PHPからGoへのマイグレーション for DMMアフィリエイト
yabakokobayashi
1
170
LINEスキマニにおけるフロントエンド開発
lycorptech_jp
PRO
0
330
.NET 9 のパフォーマンス改善
nenonaninu
0
1k
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
120
マルチプロダクト開発の現場でAWS Security Hubを1年以上運用して得た教訓
muziyoshiz
3
2.4k
KubeCon NA 2024 Recap: How to Move from Ingress to Gateway API with Minimal Hassle
ysakotch
0
200
20241214_WACATE2024冬_テスト設計技法をチョット俯瞰してみよう
kzsuzuki
3
520
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
33
3k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
How to Ace a Technical Interview
jacobian
276
23k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Raft: Consensus for Rubyists
vanstee
137
6.7k
We Have a Design System, Now What?
morganepeng
51
7.3k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Being A Developer After 40
akosma
87
590k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Java REST API Framework Comparison - PWX 2021
mraible
28
8.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Transcript
Google App Engine Λར༻ͨ͠ ৽ن Web αʔϏεͷ্ཱͪ͛ํ Osamu TONOMORI TECH
PLAY CONFERENCE 2017 (2017/08/20)
Agenda 1. Who Am I ? 2. Overview of Google
App Engine 3. In the case of Mercari Kauru 4. Summary
Who Am I ?
Who Am I ? • ओ ཧ - Osamu TONOMORI
ʢTwitter & GitHub: @osamingoʣ • גࣜձࣾικ - ϝϧΧϦΧϧνʔϜ ʢEx-Company: CyberAgent, Inc. ~ AbemaTV, Inc.ʣ • ιϑτΣΞΤϯδχΞ - Gopher ʢServer-side Leader, Scrum Master, Mood Makerʣ
My GitHub - https://github.com/osamingo
Latest interview - http://mercan.mercari.com
Overview of Google App Engine
About Google App Engine (GAE) • Google Cloud Platform ͕ఏڙ͢ΔαʔϏεͷͻͱͭɻ
• 2007ʹ Python, Java ͕͑Δ PaaS ͱͯ͠ϦϦʔεɻ • GAE ʹɺStandard Environment, Flexible Environment ͷ2छྨ͕͋Δɻ • ར༻Ͱ͖ΔϦʔδϣϯ͕ݶΒΕ͍ͯΔ͕ɺ౦ژϦʔδϣϯʹ༗Γ㽂ɻ • ओͳڝ߹ɺHeroku, Engine Yard ͳͲɻ
Google App Engine - Standard Environment (SE) • 2007ͷϦϦʔεॳ͔Β͋Δͷ͕ɺStandard Environment
Ͱ͢ɻ • ༻Ͱ͖Δݴޠ͕ɺݶΒΕ͍ͯΔɻ Python 2.7.x, Java 7 or 8(β), PHP 5.5.x, Go 1.6 or 1.8 (β) • ϧʔϧଟ͍͕ɺͦͷ։ൃӡ༻ָ͕ʹͰ͖Δɻ • ઃఆΛ͢ΕɺແྉͰ͍ଓ͚ΒΕΔɻ
Google App Engine - Flexible Environment (FE) • Google Cloud
Next 2017 ʹͯɺGA ʹͳͬͨʂ • ΞϓϦέʔγϣϯͷதɺ nginx + docker ߏʹͳ͍ͬͯΔɻ docker ͳͷͰɺՄೳੑແݶେͱ͍ͬͯաݴͰແ͍ʂ • Google ɺ Flexible Environment Λਪͯ͠ߦ͖͍ͨงғؾΛײ͡Δɻ Google App Engine ͷ LP ͕ɺFE લఏͰͷઆ໌͕ଟ͍ɻ
Google App Engine - How to choose SE or FE?
• ࠓͷͱ͜ΖɺStandard Environment Λબ͢Εؒҧ͍ͳ͍ɻ • Flexible Environment Λબ͢Δ߹ͷνΣοΫ߲ ✔ Python, Java, PHP, Go Ҏ֎ͷݴޠͰ։ൃ͍ͨ͠ɻ ✔ ϑΝΠϧ࡞ͳͲɺҰ࣌తͳσΟεΫॻ͖ࠐΈ͕ඞཁʹͳΔɻ ✔ NAT ήʔτΣΠͳͲɺ෦ωοτϫʔΫʹॴଐ͢Δඞཁ͕͋Δɻ ✔ SSH ଓΛߦ͍ɺσόοά͢Δඞཁ͕͋Δɻ
Google App Engine - Scaling • Automatic (SE, FE) Application
ͷϝτϦΫεใʹΑͬͯ Instance ͕ࣗಈՄม͢Δɻ ࣌ؒଳʹΑΔΞΫηεมಈ͕ଟ͍ɺAPI ͳͲʹ͍͍ͯΔɻ • Basic (SE) ىಈ͢Δ࠷େ Instance Λઃఆ͢Δ߹ʹઃఆ͢Δɻ ઃఆͰ͖Δ Instance class ๛ͰɺBatch ͳͲʹ͍͍ͯΔɻ • Manual (SE, FE) ىಈ͍ͯ͠Δ Instance Λݻఆ͢Δ߹ʹઃఆ͢Δɻ
Google App Engine - Database • Cloud Datastore Google ۘ
NoSQL ͷ Full-Managed αʔϏεɻ GAE ͷ߹ɺجຊతʹ Datastore Λ͏͜ͱʹͳΔɻ • Cloud SQL Full-Managed ͷ RDB αʔϏεɻ ରԠ͍ͯ͠Δͷɺ MySQL 5.6 or 5.7, PostgreSQL 9.6 (β) ͷ 2 छྨ • Others Cloud Bigtable, Cloud Spanner, etc.
Google App Engine - Caching System • Memcache GAE ͔ΒʹݶΓɺ
Managed ͷ Memcache ͕ར༻Ͱ͖Δɻ ͨΒૣ͘ 5ms ͱ͔ͰɺΩϟογϡऔಘ͕Ͱ͖Δɻ ͔͠͠ɺ՝ۚͯͨ͠ͱͯ͠ SLA อূ͞Εͳ͍ͷͰҙ
Google App Engine - Object Storage • Blobstore Cloud Storage
͕ϦϦʔε͞ΕΔ·ͰɺBlobstore ͕ओྲྀͩͬͨɻ URL ൃߦ͢Δඞཁ͕͋Δ͕ɺେ͖͍αΠζʢ2GBʣͷϑΝΠϧΛѻ͑Δɻ • Cloud Storage ݱࡏͷओྲྀɺCloud Storage Ͱར༻Λਪ͞Ε͍ͯΔɻ Blobstore ͷػೳར༻Ͱ͖ΔΑ͏ʹޓੑ͕อͨΕ͍ͯΔɻ
Google App Engine - Message Queueing • Taskqueue ֤ Service
(Module) ؒͷඇಉظॲཧʹΑ͘༻͍Δɻ GAE ͔ΒͷΈ & ႈੑ୲อΛ͠ͳ͍͍͚ͳ͍͕ɺ͍উख͕ͱͯྑ͍ɻ • Cloud Pub/Sub GAE ʹดͣ͡ɺGAE ͱଞαʔϏεΛܨ͙͜ͱ͕Ͱ͖Δɻ Cloud Storage ͷ Upload Notification ͳͲɻ
Google App Engine - Job Scheduler • Taskqueue - cron
job Taskqueue ͷ 1 ػೳͱͯ͠ɺఏڙ͞Ε͍ͯΔɻ ઃఆͨ͠ Endpoint ʹରͯ͠ Kick ͢ΔɻϦτϥΠػೳ༗Γɻ ਓؒʹ༏͍͠ઃఆه๏Ͱخ͍͠
Google App Engine - Search • Search API GAE ͔ΒݶΓར༻Ͱ͖Δɺݕࡧػೳɻ
ܗଶૉղੳɺϑΝηοτݕࡧ͋ΔͷͰߜࠐΈػೳڧ͍ɻ ͨͩ͠ɺN-gram ɺSynonym ʹରԠ͍ͯ͠ͳ͍ɻ
Google App Engine - Logging • Stackdriver Logging ΞΫηεϩάɺࣗಈతʹ Stackdriver
Logging ʹू͞ΕΔɻ ΞϓϦέʔγϣϯͰग़ྗ͢Δϩάɺಉ༷ʹू͞ΕΔɻ ಛఆͷ݅ͷϩάΛ BigQuery ʹྲྀ͢͜ͱग़དྷΔɻ
Google App Engine - Monitoring & Alert • Stackdriver Monitoring
Stackdriver Logging ͱಉ༷ʹࣗಈతʹϝτϦΫε͕ऩू͞ΕΔɻ GAE ͚ͩͰͳ͘ɺGCP ্ʹ͋ΔαʔϏεࣗಈతʹऩू͞ΕΔɻ ऩू͞ΕͨϝτϦΫεΛݩʹ Alert ͷઃఆͰ͖Δɻ
Google App Engine - Analytics • BigQuery ΈΜͳ͍͖ͩ͢ͳ BigQuery େઌੜɻ
ৄࡉɺࣳඌ͞Μ͕ͯ͘͠ΕΔͣɻ
Google App Engine - Others • Cloud Endpoint ΞΫηεཧɺϞχλϦϯά͕Ͱ͖Δ API
ήʔτΣΠɻ Open API ༷Λ༻͍ͯɺΫϥΠΞϯτͱαʔόؒͰ༷Λڞ༗Ͱ͖Δɻ gRPC (β) ൛͋Δ͕ɺݱࡏ GAE ʹະରԠ
Google App Engine - Use cases • Snapchat (Snap, Inc.)
Google Cloud Platform Live: Interview with SnapChat's Bobby Murphy https://youtu.be/17PtS1Qx8kU • Super Mario Run (Nintendo Co., Ltd. & DeNA, Inc.) Google Cloud Platform ಋೖࣄྫ - ఱಊגࣜձ༷ࣾ https://youtu.be/-29lW2EWock
In the case of Mercari Kauru
What is Mercari Kauru ?
In 3 months since launch About 1,000,000 items! About 500,000
products!
Team Members at Launch
Team Members - Server-side • ࠷ॳͷ 3 ϲ݄͙Β͍ɺࣗͻͱΓ͚ͩɻ GAE ͩͱɺΠϯϑϥߏங͍Βͳ͍ͷͰଈ͔Βίʔυॻ͚Δɻ
• ݱࡏɺ4 ਓʢ1ਓผνʔϜ݉ʣମ੍Ͱ։ൃ͍ͯ͠Δɻ શһ Server-side ΤϯδχΞͰɺInfra ઐډͳ͍ɻ
About Technology
Architecture
Service • ؆୯ʹ Microservices Λ࣮ݱ͢Δػೳ͕ Service ͱ͍͏֓೦Ͱ͢ɻ • Service ຖʹ
Endpoints Λ࣋ͪɺScaling ͷઃఆग़དྷ·͢ɻ
API Service • ٸͳߴෛՙʹରԠͰ͖ΔΑ͏ʹ Automatic Scaling Λ࠾༻ɻ • e.g. Mercari
͔Βͷ༠ಋͰҰؾʹෛՙ͕2ഒҎ্ʹͳΔ͜ͱ͕͋Δɻ
Webhook Service • ֎෦αʔϏε͔Βͷ Event Λड͚͚Δɻ • Mercari, Tracking ͳͲ
• Webhook Ͱɺ۩ମతͳॲཧ͠ͳ͍ɻ • Taskqueue ʹྲྀ͔͢ɺLogging Λߦ͏͚ͩɻ • ڧ͍ Instance ཁΒͳ͍͠ɺScale out ͚ͩͯ͘͠ΕΕྑ͍ɻ
Management Service (Event & Batch) • ඇಉظͰߦ͏ॲཧΛશ͚ͯෛ͏αʔϏε • Basic Scaling
Ͱ Instance Class ΛڧΊʹઃఆͯ͠ॲཧ͠·͘Δɻ • ࣌ؒͷ͔͔Δ Batch ॲཧߦ͏ɻ ʢਖ਼ɺSubscriber, Batch ʹׂ͢Εྑ͔ͬͨͱޙչ͍ͯ͠Δɻʣ
Other Services • Admin ཧπʔϧͳͷͰɺInstance ΛཱͯΔඞཁແ͠ɻ • Admin API ཧπʔϧ͚ͷ
API ͳͷͰɺ0~1 instance ͰOKɻ
Database • Mercari Kauru Ͱɺ ɹCloud Datastore ɹCloud SQLʢMySQL 5.7ʣ
ͷͲͪΒར༻͍ͯ͠·͢ɻ • DDD Λ࠾༻͍ͯͯ͠ɺ Domain Repository ͰӅṭ͍ͯ͠Δɻ
Database - Cloud Datastore • Datastore ͰɺMercari Kauru ݻ༗ͷσʔλΛอ͍࣋ͯ͠·͢ɻ •
ಛʹແݶʹੵ͞Ε͍ͯ͘ܥͷσʔλɺNoSQL ͷಘҙɻ • Like, Stock, Notification, PushNotificationToken, etc.
Database - Cloud SQL • MySQL ʹɺͷϚελσʔλΛอ͍࣋ͯ͠·͢ɻ • ݩͷ Schema
͕ɺਖ਼نԽ͞Ε͍ͯͯ NoSQL ʹ֨ೲ͢Δͷ͍͠ɻ • Ϛελσʔλɺܗ͞Ε Cache Խ͞ΕΔͷͰɺগΞΫηεɻ ʢGAE ͔Βɺ12 connections/instance ͱ੍ݶ͞Ε͍ͯΔɻʣ • ͜͜Λؒҧ͑ΔͱΤά͍ͷͰɺอશ͕ୈҰͷબΛͨ͠ɻ
Version • Service ɺෳͷ Version Λ࣋ͭ͜ͱ͕Ͱ͖Δɻ 1SPKFDU 4FSWJDF 7FSTJPO .FSDBSJ,BVSV
"1* W W #BUDI W W
Version - Production • Production ͰɺCanary release Λͨ͠ΓɺRollback ༻ҙʹՄೳɻ •
10% ͚ͩ։์ͨ͠Γͯ͠ɺ༷ࢠΛݟͨΓͰ͖Δɻ
Version - Development • Development Ͱɺbranch ຖʹڥΛ؆୯ʹ༻ҙ͍ͯ͠Δɻ • ֤ Version
ʹݻ༗ͷαϒυϝΠϯ͕ൃߦ͞ΕΔɻ • ฒྻͰػೳ։ൃɺQA Λߦ͑ΔͷͰͱͯศརɻ
Logging & Analytics • Application ͔Βॻ͖ग़͢ϩά JSON Format Ͱॻ͖ग़͍ͯ͠Δɻ •
Stackdriver Logging ʹू͞ΕͨޙɺBigQuery ʹྲྀ͠ࠐΜͰ͍Δɻ BigQuery ʹɺJSON ͕ؔ͋ΔͷͰѻָ͍͕ʹͳΔɻ • Firebase Analytics ͔Β BigQuery ʹ Event ϩάΛྲྀ͠ࠐΜͰ͍Δɻ Server, Client Λॎஅͯ͠ੳΛߦ͑Δ (๑•̀ŷ•́)و✧
Release & Deploy • શͯ ChatOps Ͱߦ͍ͬͯΔɻ @kaurungo [release, migrate,
traffic, etc.] • GAE ʹ Admin API ͱ͍͏ɺ༷ʑͳૢ࡞͕Ͱ͖Δ API ͕͋Δɻ ops-bot ͱ͍͏ Service Λͬͯɺ GAE ্Ͱӡ༻͍ͯ͠Δɻ
Summary
Summary • খ࢝͘͞ΊΔͳΒ Google App Engine ɺྑ͍બࢶͷͻͱͭɻ ಛʹ։ൃΑΓɺӡ༻ΛΞάϨογϒʹߦ͑Δɻ • େ͖͘ҭͯΔͷྑ͠ɺGCP
ͷԸܙΛଟ͘ड͚Δ͜ͱ͕Ͱ͖Δɻ ͱͯͭͳ͘ώοτͨ͠Βɺ࠷খݶͷίετͰ GCE, GKE ʹҠߦͰ͖Δɻ • φϨοδੵ͞Ε͍ͯΔ͠ɺϝϯςφϯε׆ൃʹߦΘΕ͍ͯΔɻ ಛʹຊͰɺGCPUG ίϛϡχςΟͷԸܙ͕ड͚ΒΕΔɻ
Thanks for your attention!