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
54k
Other Decks in Technology
See All in Technology
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
310
Zennのパフォーマンスモニタリングでやっていること
ryosukeigarashi
0
150
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.5k
rootlessコンテナのすゝめ - 研究室サーバーでもできる安全なコンテナ管理
kitsuya0828
3
390
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.2k
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
1
110
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
OCI Security サービス 概要
oracle4engineer
PRO
0
6.5k
Adopting Jetpack Compose in Your Existing Project - GDG DevFest Bangkok 2024
akexorcist
0
110
iOS/Androidで同じUI体験をネ イティブで作成する際に気をつ けたい落とし穴
fumiyasac0921
1
110
Application Development WG Intro at AppDeveloperCon
salaboy
0
190
TypeScript、上達の瞬間
sadnessojisan
46
13k
Featured
See All Featured
Building Adaptive Systems
keathley
38
2.3k
Git: the NoSQL Database
bkeepers
PRO
427
64k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Docker and Python
trallard
40
3.1k
Code Reviewing Like a Champion
maltzj
520
39k
Designing the Hi-DPI Web
ddemaree
280
34k
Raft: Consensus for Rubyists
vanstee
136
6.6k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Designing Experiences People Love
moore
138
23k
For a Future-Friendly Web
brad_frost
175
9.4k
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!