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
AGIについてChatGPTに聞いてみた
blueb
0
130
安心してください、日本語使えますよ―Ubuntu日本語Remix提供休止に寄せて― 2024-11-17
nobutomurata
0
980
AIチャットボット開発への生成AI活用
ryomrt
0
170
Can We Measure Developer Productivity?
ewolff
1
150
dev 補講: プロダクトセキュリティ / Product security overview
wa6sn
1
2.3k
【若手エンジニア応援LT会】ソフトウェアを学んできた私がインフラエンジニアを目指した理由
kazushi_ohata
0
150
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
250
Application Development WG Intro at AppDeveloperCon
salaboy
0
180
iOS/Androidで同じUI体験をネ イティブで作成する際に気をつ けたい落とし穴
fumiyasac0921
1
110
OCI Security サービス 概要
oracle4engineer
PRO
0
6.5k
Making your applications cross-environment - OSCG 2024 NA
salaboy
0
180
10XにおけるData Contractの導入について: Data Contract事例共有会
10xinc
5
580
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
94
13k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Why Our Code Smells
bkeepers
PRO
334
57k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
410
GitHub's CSS Performance
jonrohan
1030
460k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Happy Clients
brianwarren
98
6.7k
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!