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
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
420
kargoの魅力について伝える
magisystem0408
0
200
10分で学ぶKubernetesコンテナセキュリティ/10min-k8s-container-sec
mochizuki875
3
320
マルチプロダクト開発の現場でAWS Security Hubを1年以上運用して得た教訓
muziyoshiz
2
2.1k
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
12
3.3k
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
OpenShift Virtualizationのネットワーク構成を真剣に考えてみた/OpenShift Virtualization's Network Configuration
tnk4on
0
130
watsonx.ai Dojo #5 ファインチューニングとInstructLAB
oniak3ibm
PRO
0
160
20241220_S3 tablesの使い方を検証してみた
handy
3
220
第3回Snowflake女子会_LT登壇資料(合成データ)_Taro_CCCMK
tarotaro0129
0
180
Turing × atmaCup #18 - 1st Place Solution
hakubishin3
0
470
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
150
Featured
See All Featured
Producing Creativity
orderedlist
PRO
341
39k
Building Adaptive Systems
keathley
38
2.3k
Why Our Code Smells
bkeepers
PRO
335
57k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Navigating Team Friction
lara
183
15k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Scaling GitHub
holman
458
140k
BBQ
matthewcrist
85
9.4k
Thoughts on Productivity
jonyablonski
67
4.4k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
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!