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.7k
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
新卒1年目が挑む!生成AI × マルチエージェントで実現する次世代オンボーディング / operation-ai-onboarding
cyberagentdevelopers
PRO
1
160
マネジメント視点でのre:Invent参加 ~もしCEOがre:Inventに行ったら~
kojiasai
0
460
【若手エンジニア応援LT会】AWSで繋がり、共に成長! ~コミュニティ活動と新人教育への挑戦~
kazushi_ohata
0
180
最速最小からはじめるデータプロダクト / Data Product MVP
amaotone
5
730
物価高なラスベガスでの過ごし方
zakky
0
380
ユーザーの購買行動モデリングとその分析 / dsc-purchase-analysis
cyberagentdevelopers
PRO
2
100
ガチ勢によるPipeCD運用大全〜滑らかなCI/CDを添えて〜 / ai-pipecd-encyclopedia
cyberagentdevelopers
PRO
3
200
「 SharePoint 難しい」ってよく聞くけど、そんなに言うなら8歳の息子に試してもらった
taichinakamura
1
620
APIテスト自動化の勘所
yokawasa
7
4.1k
よくわからんサービスについての問い合わせが来たときの強い味方 Amazon Q について
kazzpapa3
0
220
Autify Company Deck
autifyhq
1
39k
GitHub Universe: Evaluating RAG apps in GitHub Actions
pamelafox
0
170
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
264
13k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
504
140k
Unsuck your backbone
ammeep
668
57k
Thoughts on Productivity
jonyablonski
67
4.3k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
37
1.8k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
A Tale of Four Properties
chriscoyier
156
23k
GraphQLの誤解/rethinking-graphql
sonatard
66
9.9k
Music & Morning Musume
bryan
46
6.1k
The Power of CSS Pseudo Elements
geoffreycrofte
72
5.3k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
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!