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
創業3年のSaaSスタートアップが 規模急拡大に対してアーキテクチャを変革していった話 / S...
Search
showmant
September 28, 2021
Programming
0
880
創業3年のSaaSスタートアップが 規模急拡大に対してアーキテクチャを変革していった話 / Scalebase's architectural transformation
showmant
September 28, 2021
Tweet
Share
More Decks by showmant
See All by showmant
Why Alp Choose Modular monolith Architecture
showmant
2
3.3k
シード期のプロダクト開発について / Product Development in the Seed Phase
showmant
0
1.9k
モジュラモノリスで表現する複雑なドメイン領域と境界 / Expressing complex domain regions and boundaries with 'modular monoliths
showmant
8
12k
SaaS企業をスケールさせるためにScalaを選択した理由と1年間の振り返り / Why Alp Choose Scala To Scale The Application
showmant
2
1.9k
Other Decks in Programming
See All in Programming
Beyond ORM
77web
11
1.6k
shadcn/uiを使ってReactでの開発を加速させよう!
lef237
0
300
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
9
2.4k
AHC041解説
terryu16
0
400
ESLintプラグインを使用してCDKのセオリーを適用する
yamanashi_ren01
2
240
AWSのLambdaで PHPを動かす選択肢
rinchoku
2
390
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
300
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
940
ecspresso, ecschedule, lambroll を PipeCDプラグインとして動かしてみた (プロトタイプ) / Running ecspresso, ecschedule, and lambroll as PipeCD Plugins (prototype)
tkikuc
2
1.9k
テストコード書いてみませんか?
onopon
2
340
[JAWS-UG横浜 #80] うわっ…今年のServerless アップデート、少なすぎ…?
maroon1st
0
100
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
1.3k
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Unsuck your backbone
ammeep
669
57k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Code Review Best Practice
trishagee
65
17k
It's Worth the Effort
3n
183
28k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.4k
Optimizing for Happiness
mojombo
376
70k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Designing for Performance
lara
604
68k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
7k
Transcript
J A P A N | S E P T
E M B E R 2 8 , 2 0 2 1
© 2021, Amazon Web Services, Inc. or its affiliates. All
rights reserved. ۀ3ͷSaaSελʔτΞοϓ͕ نٸ֦େʹରͯ͠ΞʔΩςΫνϟΛมֵ͍ͯͬͨ͠ Speaker Name Shoma Takeo | Alp, Inc. B - 3
Ξϧϓגࣜձࣾ ڞಉۀऀ औక (tw: showmant_ ) 2014ʹגࣜձࣾαΠόʔΤʔδΣϯτʹೖࣾɻಈը ࠂ৴ࣄۀʹ͓͚Δ։ൃऀΛ୲ɻͦͷޙήʔ Ϝࣄۀऀ͚ͷϦλʔήςΟϯάࠂ৴ࣄۀͷถࠃ ࣄۀ্ཱͪ͛ʹ։ൃऀͱͯ͠ैࣄɻ
ΞϧϓͰόοΫΤϯυΤϯδχΞΛओͱͯ͠ɺݱࡏ ։ൃ৫શମͷϚωʔδϝϯτɾ࠾༻Λ୲ɻ झຯϥʔϝϯ(࠷ۙࣽׯ͠ܥɾ୶ྷܥɾೋ)Λ৯ Δ͜ͱɾεϙʔπ؍ઓΛ͢Δ͜ͱ ࣗݾհ - ඌ ਖ਼അ -
© 2021, Amazon Web Services, Inc. or its affiliates. All
rights reserved. ձࣾհ
None
None
© 2021, Amazon Web Services, Inc. or its affiliates. All
rights reserved. ϓϩμΫτհ
SaaS/
© 2021, Amazon Web Services, Inc. or its affiliates. All
rights reserved. SaaS/αϒεΫϦϓγϣϯϏδωεʹ͓͚Δ
None
None
None
None
None
1 30 5 10 1 MRR/ 120
© 2021, Amazon Web Services, Inc. or its affiliates. All
rights reserved. ࠾༻ٕज़
࠾༻ٕज़
© 2021, Amazon Web Services, Inc. or its affiliates. All
rights reserved. ۀॳظͷΞʔΩςΫνϟͷ3ͭͷ
© 2021, Amazon Web Services, Inc. or its affiliates. All
rights reserved. 1. AWS FinTech ϦϑΝϨϯεɾΞʔΩςΫνϟʔΛࢀߟʹͨ͠
• ͳͥϑΟϯςοΫϦϑΝϨϯεΞʔΩςΫνϟʁ • ސ٬ͷࣄۀσʔλٻσʔλΛѻ͏ͨΊηΩϡϦςΟΛҙࣝͨ͠ΞʔΩςΫνϟ͢Δඞཁੑ • BtoBࣄۀͨΊߴ͍ηΩϡϦςΟཁ͕݅ސ٬͔ΒٻΊΒΕΔ߹͕ଟ͍ AWS FinTech ϦϑΝϨϯεɾΞʔΩςΫνϟʔ
• ޙ͔Β࣮ࢪ͢ΔͱɺΞΧϯτΛ͢Δͷେม • ։ൃڥͱຊ൪ڥͰΞΫηεݖݶΛ໌֬ʹ͚ΔϝϦοτ • ۀʹඞཁͳݖݶΛϦεΫ͑ͯͤΔͷͰޮΑ͘ࣄͰ͖Δ • IAMઃఆʹޡΓ͕͋ͬͨͱ͖ʹΞΫηεൣғ֦େͷඃΛ͑ΒΕΔ ಛʹҙͨ͠ϙΠϯτ ຊ
൪ ڥ ͱ ։ ൃ ڥ Ͱ AW S Ξ Χ ϯ τ ͷ
※ݱঢ়ߏͱଟগҟͳΓ·͢
© 2021, Amazon Web Services, Inc. or its affiliates. All
rights reserved. 2. Amazon Elastic Kubernetes Service (Amazon EKS)Λ࠾༻ͨ͠
• k8sͷӡ༻ͷࣝΛ࣋ͬͨϝϯόʔ͕͍͔ͨΒ࠾༻Ͱ͖ͨ • ͯ͢ͷέʔεʹ͓͍ͯAmazon EKS͕༗ޮͰ͋Δͱ͍͏͜ͱͳ͍ • ίϯτʔϥϏϦςΟͷߴ͞ • ࣗࣾͷϢʔεέʔεʹซͤͯࣗ༝ͷߴ͍֦ுՄೳ •
KubernetesͷڊେͳίϛϡχςΟͷࢿݯΛ׆༻Մೳ • ίϛϡχςΟͷੑͷظ • OSSͰߏ͞Ε͍ͯΔτϥϒϧγϡʔςΟϯά͕͍͢͠ • ࠔͬͨͱ͖ʹཔΕΔΦʔϓϯͳใ͕๛ Why Amazon EKS?
• δϣϒΛ୯ൃͰಈ͔͠ɺඪ४ग़ྗͰϩάΛड͚औΓ͍ͨέʔεΛ؆୯ʹ ରԠͰ͖ΔΑ͏ʹͨ͠ • goccy/kubejobΛͬͯɺMain ClassΛࢦఆͯ͠ҙͷScalaόονΛk8sͰىಈͰ͖ΔΑ͏ʹͨ͠ Amazon EKSͷ ख ಈ
࣮ ߦ δ ϣ ϒ
• CronJobͷ੍ • ࣮ߦࢹΛ͢Δඞཁ͕͋Δ • ಉҰεέδϡʔϧͰ2ճ࣮ߦ͞ΕΔ͜ͱ͋ΔͷͰႈʹॲཧΛΉඞཁ͕͋Δ • default namespaceΛ͏ࡍҙ •
applyͷద༻Λޡͬͨ࣌ʹdefault namespaceʹ͋ͨͬͯ͠·͏ ؾΛ͚ͭΔ͜ͱɾΑ͘ͳ͔ͬͨ͜ͱ
© 2021, Amazon Web Services, Inc. or its affiliates. All
rights reserved. ۀ͔Β3ؒͷΞʔΩςΫνϟͷมֵ
• ϞϊϦε => ϞδϡϥϞϊϦεԽ • ϚΠΫϩαʔϏεͷҠߦՄೳ • ϦʔυϞσϧԽରԠ • σʔλϞσϧͷංେԽʹΑΓࢀরύϑΥʔϚϯε͕Լ͕ͬͨͨΊɺࢀর༻ͷϏϡʔϞσϧΛ
όοΫΤϯυΞϓϦέʔγϣϯͰ࡞ • ݁Ռ߹ੑʹଇͬͨඇಉظΞϓϦέʔγϣϯઃܭ • Spark on Kubernetes ͷಋೖ ΞʔΩςΫνϟมֵ֓ཁ
• ϢʔβʔຖͰσʔλྔʹ෯͕͋Δ߹ͷઃܭ • σʔλྔʹىҼͯ͠ॲཧ͕͘ͳΔ՝ʹର͢Δઃܭ ࠓճ͍ͨ͠ςʔϚ
• ސ٬ͷن͕ҧ͏Ϣʔβ ʔ͕ར༻͢ΔͱɺٸܹʹϨ ίʔυͷΦʔμʔ͕มԽ ͢Δ • σʔλنͷେখʹؔΘΒ ͣɺͯ͢ͷϢʔβʔʹૉ Β͍͠ϓϩμΫτମݧΛ ఏڙ͢Δඞཁ͕͋Δ
ςʔϚ1: ϢʔβʔຖͰσʔλྔʹ෯͕͋Δ
• ϓϩμΫτͷੑ্࣭ɺ1ܖͷΦϒδΣΫταΠζ͕େ͖͍ • ॳظͷScalebaseΛར༻͍ͯͨ͠Ϣʔβʔͷσʔλྔ1ΦϒδΣΫτ͋ ͨΓଟͯ͘ ~ 1000Ϩίʔυ • ୯ҰͷॲཧͰѻ͏ΦϒδΣΫτ ~
1000 ఔͩͬͨ ςʔϚ2: σʔλྔʹىҼͯ͠ॲཧ͕͘ͳΔ՝ͷରॲ લ ఏ
• େنσʔλΛҰʹૢ࡞͢Δঢ়گʹͳΔ·ͰɺΦϒδΣΫτΛؾʹ ͤͣɺͯ͢ಉҰτϥϯβΫγϣϯͰॲཧ͍ͯͨ͠ • 10000~ ͷΦϒδΣΫτΛಉ࣌ʹૢ࡞͢Δ߹ʹಉظతॲཧͰϢʔβ ʔମݧ͕ஶ͘͠ଛͳΘΕΔঢ়گʹ • ސ٬ମݧΛٻ͢Δ্Ͱ݁Ռ߹ੑΛՃຯͨ͠ඇಉظΞϓϦέʔγϣϯઃܭʹτϥΠ ςʔϚ2:
σʔλྔʹىҼͯ͠ॲཧ͕͘ͳΔ՝ͷରॲ ՝
© 2021, Amazon Web Services, Inc. or its affiliates. All
rights reserved. CSVϑΝΠϧΛͬͨ༻ྔΠϯϙʔτ ػೳͷઃܭ
• αϒεΫϦϓγϣϯͷதʹAWSͷΑ͏ʹ༻ͨ͠ྔʹԠ͡ٻֹ͕ܾఆ͢ Δϓϥϯମܥ͕͋Δ • ༻ྔΛCSVग़ྗͯ͠ɺμογϡϘʔυ͔ΒΠϯϙʔτ • σʔλྫ) ސ٬AαϒεΫϦϓγϣϯ1ʹରͯ͠ 2021-09-28 ʹ50GBར༻ͨ͠
• ݄ʹ༻ྔΛूܭͯ͠ɺͦͷ߹ܭͰٻֹΛܾఆ ※ API࿈ܞʹΑΔ༻ྔͷΠϯϙʔτػೳૣظఏڙ༧ఆ ༻ྔCSVΠϯϙʔτػೳઆ໌
None
• CSVϑΝΠϧ͕ΞοϓϩʔυͰ͖Δ • μογϡϘʔυܦ༝Ͱͳ͘खಈ (curlίϚϯυ) ͰΞοϓϩʔυͰ͖Δ • 10ߦ ~ 100ສߦͷCSVϑΝΠϧʹ͑ΒΕΔ
Version 1ͷػೳཁ݅
ॳظͷઃܭɾ࣮
• CSVΞοϓϩʔυͷͨͼʹAmazon EMRΫϥελʔͷ Πϯελϯε֬อ ͱ ηοτΞοϓ͢ΔͨΊʹΦʔόʔϔου͕େ͖͍ • େ༰ྔσʔλͰ͋Εڐ༰Ͱ͖Δ • ࣮ࡍʹӡ༻Λ։࢝͢Δͱ100ߦఔͷϑΝΠϧ͕ଟ͘ɺඇػೳཁ݅ͱͯ͠Ξοϓϩʔυྃ·Ͱͷ
͕͔͔࣌ؒΓ͗͢Δ • γεςϜ/Τϥʔϩά͕Amazon EMR্ʹ͔͠ͳ͍ • Πϯϙʔτͷਐḿ͕Amazon EMRͷεςʔλεΛݟΔҎ֎ํ๏͕ͳ͍ ු͔ͼ্͕ͬͨ՝
• CSVϑΝΠϧ͕ΞοϓϩʔυͰ͖Δ͜ͱ • μογϡϘʔυͰϢʔβʔ͕Ξοϓϩʔυ͕Ͱ͖Δ͜ͱ • 10ߦ ~100ສߦΫϥεͷCSVϑΝΠϧʹ͑ΒΕΔ͜ͱ • αΠζͷখ͍͞CSVϑΝΠϧͰΞοϓϩʔυΛ্ͤ͞Δ͜ͱ •
ΠϯϙʔτεςʔλεΛμογϡϘʔυ্͔Β֬ೝͰ͖Δ͜ͱ • Πϯϙʔτ࣌ʹΤϥʔΛμογϡϘʔυͰ֬ೝͰ͖Δ͜ͱ Version 2 Ͱຬ͖ͨ͢ཁ݅
None
• αʔόʔϨεͷϫʔΫϑϩʔΛ؆୯ʹߏஙͰ͖Δ • S3ʹϑΝΠϧ͕ஔ͔Εͨ͜ͱΛىҼʹॲཧΛൃՐͤ͞Δ ▪ S3Πϕϯτͷ্༷ At Least Once Ͱݺͼग़͞ΕΔͨΊɺLambdaͱͷͷ࿈ܞͷ߹ɺॏෳͰॲཧ
͕ͬͯ͠·͏Մೳੑ͕͋Δ – CloudTrailͷར༻ ઃܭͷϙΠϯτ AW S S T E P F U N C T I O N S Λ ར ༻ ͯ͠ ͍ Δ
• CSVϑΝΠϧͷαΠζʹΑͬͯॲཧΛذ • ॲཧ༰ಉ͕ͩ͡ɺํ๏Amazon EMR·ͨSpark on KubernetesΛ͏͔Ͱذ • σʔλ༰ྔ͕খ =>
Spark on Kubernetes • 1ఔͰॲཧ͕ྃ͢Δ • σʔλ༰ྔ͕େ => Amazon EMR Λར༻͢Δ • ࣮ࡍͪ͜ΒΛ͏͜ͱΊͬͨʹͳ͍͕ىಈ·Ͱʹ10Ҏ্͏ • Spot instance ͳͷͰɺΫϥελʔ֬อʹ࣌ؒΛཁ͢Δ͜ͱ͋Δ ઃܭͷϙΠϯτ σ ʔ λ α Π ζ ʹ Α ͬͯ σ ʔ λ ॲ ཧ ํ ๏ Λ ม ߋ Ͱ ͖ Δ Α ͏ ʹ ͠ ͨ
© 2021, Amazon Web Services, Inc. or its affiliates. All
rights reserved. ٻੜػೳʹ͓͚Δ ඇಉظδϣϒཧͷઃܭ
• αϒεΫϦϓγϣϯجຊతʹɺຖ݄ҰఆͷλΠϛϯάͰٻ͕ൃੜ͢Δ • ScalebaseͰͱͱɺαϒεΫϦϓγϣϯ͝ͱʹܾ·ͬͨλΠϛϯάͰٻΛग़͢ػೳΛఏڙͯ͠ ͍Δ • ͔͠͠ɺಛʹBtoBͷαʔϏεͰॴఆͷλΠϛϯάΛͨͣʹٻΛ͢Δ ߹͕ൃੜ͢Δ • ྫ)
ૣΊʹٻΛग़͢͜ͱΛސ٬ʹٻΊΒΕΔ • ྫ) ΞοϓηϧͳͲʹΑΓɺΠϨΪϡϥʔͳλΠϛϯάͰٻ͕ൃੜ͢Δ • ҙͷλΠϛϯάͰͷαϒεΫϦϓγϣϯ͔ΒٻੜΛ࣮ߦͰ͖ΔΈ ͷߏங͕ඞཁ ҙλΠϛϯάͷٻੜػೳ
None
None
None
• ෳͷαϒεΫϦϓγϣϯΛબͯ͠ಉ࣌ʹٻੜ͕Ͱ͖Δ͜ͱ • ඇಉظʹॲཧΛ࣮ߦͰ͖Δ͜ͱ • ٻੜͷਐߦঢ়گ͕μογϡϘʔυͰ֬ೝͰ͖Δ͜ͱ • ࣦഊͨ͠߹ͷΤϥʔΛμογϡϘʔυͰ֬ೝͰ͖Δ͜ͱ • ෳͷδϣϒΛੵΉ͜ͱ͕Ͱ͖Δ͜ͱ
ػೳཁ݅
None
• Why not Amazon SQS? • େྔͷΠϕϯτ͕ྲྀΕͯ͘ΔՄೳੑ͕ߴ͘ɺγϟʔυΛՃ͢Δ͜ͱͰεέʔϧ͕༰қͰ͋Δ • 1ͭͷΠϕϯτͰෳͷॲཧΛΒ͍ͤͨχʔζ͕ࠓޙ͋Γ͏ΔͨΊ •
ྫ) ࠪϩάग़͍ͨ͠ => ࠪϩάΛग़ྗ͢ΔConsumerΛՃ͢Δ͜ͱͰରԠͰ͖Δ ͳͥKinesisΛ࠾༻͔ͨ͠ʁ ઃ ܭ ͷ ϙ Π ϯ τ
• νʔϜͰ͍͘͢͢Δ • ϨίʔυͷॲཧʹίϯγϡʔϚʔͷॲཧ͕ࣦഊͨ͠߹ɺνΣοΫϙΠϯτΛଧͨͳ͍͜ͱͰ ࣦഊ࣌ͷΤϥʔϋϯυϦϯάΛ͍ͯ͘͢͠͠Δ • ϦτϥΠ͠ଓ͚ΔϨίʔυ͕ൃੜͨ͠ࡍɺҎԼͷ3ͭͷ͍ͣΕ͔ͷରԠΛߦ͍ͬͯΔ • ରͷϨίʔυΛਖ਼͘͠ॲཧͰ͖ΔΑ͏ʹίʔυΛमਖ਼ͯ͠ΞϓϦΛσϓϩΠ͢͠ •
ରͷϨίʔυΛਖ਼͘͠ॲཧͰ͖ΔΑ͏DBͷσʔλΛमਖ਼͢Δ • ରͷϨίʔυࣗମʹ͕͋Δ߹ϨίʔυΛεΩοϓ͢Δӡ༻खॱΛ࣮ࢪ͢Δ ॳΊͯͷ Kinesis ࠾༻ ઃ ܭ ͷ ϙ Π ϯ τ
• ಉ͡ϨίʔυΛॏෳͯ͠ίϯγϡʔϚʔ͕ॲཧ͢ΔՄೳੑ͕͋Δ • ຊདྷႈੑΛอͭ͜ͱͰॏෳͷՄೳੑΛߟྀ͖͢ • δϣϒͷঢ়ଶཧͷඞཁੑͱ࣮ͷ߹্ͰɺॏෳΛ͙ख๏ΛऔΓೖΕͨ • Elasticacheʹॲཧͷঢ়گΛӬଓԽ͓ͯ͘͜͠ͱͰॏෳ͍ͯͨ͠Β͘ΈΛऔ͍ͬͯΔ ॏෳνΣοΫʹAmazon ElastiCache
Λ࠾༻ ઃ ܭ ͷ ϙ Π ϯ τ
• KinesisͱElasticacheΛΈ߹ΘͤΔ͜ͱͰɺඇಉظʹδϣϒΛ࣮ߦ͠ͳ ͕ΒɺਐḿΛཧ͢Δ͜ͱ͕Մೳ • Τϥʔ͕ൃੜͨ͠Πϕϯτʹରͯ͠ɺνΣοΫϙΠϯτΛ͚ͭͳ͍͜ͱ ͰΤϥʔରԠ͕༰қʹͳͬͨ • ҰํͰΤϥʔʹͳͬͨϨίʔυ͕ετϦʔϜʹཹͯ͠͠·͏͋Δ • Τϥʔ༻ͷετϦʔϜʹྲྀͯ͠ɺޙଓΛ٧·Βͤͳ͍վળ͕ඞཁ
ྑ͔ͬͨ/վળ ݁ Ռ ߹ ੑ ʹ ଇ ͬ ͨ Ξ ϓ Ϧ έ ʔ γ ϣ ϯ Λ ॳ Ί ͯ ν ʔϜ Ͱ ։ ൃ Ͱ ͖ ͨ
• ΞϓϦέʔγϣϯ͕ྫ֎Λεϩʔͨ͠ͱ͖ʹɺKCLͰϋϯυϦϯά͠ͳ ͍ͱɺνΣοΫϙΠϯτΛ͏ͬͯ͠·͍ɺਖ਼͘͠ॲཧ͞Εͳ͍··ͷΠ ϕϯτ͕ൃੜͯ͠͠·͏ • ॲཧਖ਼ৗॲཧྃޙνΣοΫϙΠϯτ͕ͭ͘Α͏ʹྫ֎࣌νΣοΫϙΠϯτΛଧͨͣʹϦτϥΠ͢Δ ΈΛಋೖͨ͠ • Ϩίʔυͷ͋ͨΓͷαΠζʹ੍ݶ͕͋ΔͷͰαΠζͷେ͖͍ϨίʔυΛ Kinesis
ʹ͛Δ߹ҙ • ੍ݶΛߟྀͯ͠ϦετΛௐ͢Δඞཁ͕͋ͬͨ • ຊདྷ1ཁૉ1Πϕϯτʹ͍͕ͨ͠ɺδϣϒͷதʹෳͷΠϕϯτ͕͋Δ߹ɺ࢝ͱऴΛҙ࣮ࣝͨ͠ ͢Δඞཁ͕͋ΓɺϦετܕʹͨ͠ ͭ·͍ͮͨͱ͜Ζɺۤ࿑ͨ͠ͱ͜Ζ
© 2021, Amazon Web Services, Inc. or its affiliates. All
rights reserved. ͍͞͝ʹ
• Amazon EMR on Amazon Elastic Kubernetes Service (EKS) ͷಋೖ
• EMR Λ༻ͯ͠ɺϑϨʔϜϫʔΫͷΠϯετʔϧͱཧͳͲͷΛݮͰ͖ͦ͏ • Kinesis ͷԠ༻ • Τϥʔ࣌ͷϋϯυϦϯάͱͯ͠ผͷStreamʹΠϕϯτΛૹΔ • ิঈτϥϯβΫγϣϯͷ࣮ ࠓޙɺݕ౼/ઓ͍͖͍ͯͨ͜͠ͱ
© 2021, Amazon Web Services, Inc. or its affiliates. All
rights reserved. WE ARE HIRING.
Thank you! © 2021, Amazon Web Services, Inc. or its
affiliates. All rights reserved.