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
Symfony Mapper Component
soyuka
2
730
暇に任せてProxmoxコンソール 作ってみました
karugamo
1
720
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
250
103 Early Hints
sugi_0000
1
220
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
770
バグを見つけた?それAppleに直してもらおう!
uetyo
0
170
Refactor your code - refactor yourself
xosofox
1
260
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
180
Recoilを剥がしている話
kirik
5
6.6k
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
200
Semantic Kernelのネイティブプラグインで知識拡張をしてみる
tomokusaba
0
180
Featured
See All Featured
The Cult of Friendly URLs
andyhume
78
6.1k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
247
1.3M
Code Review Best Practice
trishagee
65
17k
4 Signs Your Business is Dying
shpigford
181
21k
Designing for Performance
lara
604
68k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.3k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Embracing the Ebb and Flow
colly
84
4.5k
Producing Creativity
orderedlist
PRO
341
39k
Gamification - CAS2011
davidbonilla
80
5.1k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
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.