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.2k
シード期のプロダクト開発について / 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
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
270
Kaigi on Railsに初参加したら、その日にLT登壇が決定した件について
tama50505
0
100
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
130
tidymodelsによるtidyな生存時間解析 / Japan.R2024
dropout009
1
790
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
120
Security_for_introducing_eBPF
kentatada
0
110
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
130
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
2
390
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
140
Go の GC の不得意な部分を克服したい
taiyow
3
790
fs2-io を試してたらバグを見つけて直した話
chencmd
0
230
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Become a Pro
speakerdeck
PRO
26
5k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Navigating Team Friction
lara
183
15k
Adopting Sorbet at Scale
ufuk
73
9.1k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Speed Design
sergeychernyshev
25
670
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
A designer walks into a library…
pauljervisheath
204
24k
Docker and Python
trallard
42
3.1k
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.