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
Scala and Akka apps on Kubernetes in ChatWork
Search
hayasshi
September 09, 2017
Technology
0
2.4k
Scala and Akka apps on Kubernetes in ChatWork
2017-09-09 Scala関西Summit 2017
hayasshi
September 09, 2017
Tweet
Share
More Decks by hayasshi
See All by hayasshi
Chatwork で Akka をどうつかっているのか なぜつかっているのか / Why Akka, How Akka in Chatwork
hayasshi
1
480
とある会社のビルドデプロイ / A certain company's application building
hayasshi
0
310
Scala / refined で`型く`表明プログラミング / Programing with type level assertion
hayasshi
2
810
Akka Typed - 型安全にメッセージパッシングする! / Akka Typed - typesafe messaging
hayasshi
6
2.4k
AWS Dev Day Challenge (2018-11-02) - ChatWork Suita
hayasshi
2
540
Other Decks in Technology
See All in Technology
Apple/Google/Amazonの決済システムの違いを踏まえた定期購読課金システムの構築 / abema-billing-system
cyberagentdevelopers
PRO
1
210
来年もre:Invent2024 に行きたいあなたへ - “集中”と“つながり”で楽しむ -
ny7760
0
460
物価高なラスベガスでの過ごし方
zakky
0
370
Java x Spring Boot Warm up
kazu_kichi_67
2
490
Autify Company Deck
autifyhq
1
39k
Nix入門パラダイム編
asa1984
2
200
ガバメントクラウド先行事業中間報告を読み解く
sugiim
1
1.2k
「 SharePoint 難しい」ってよく聞くけど、そんなに言うなら8歳の息子に試してもらった
taichinakamura
1
600
Fargateを使った研修の話
takesection
0
110
分布で見る効果検証入門 / ai-distributional-effect
cyberagentdevelopers
PRO
4
690
プロダクト成長に対応するプラットフォーム戦略:Authleteによる共通認証基盤の移行事例 / Building an authentication platform using Authlete and AWS
kakehashi
1
150
顧客が本当に必要だったもの - パフォーマンス改善編 / Make what is needed
soudai
24
6.7k
Featured
See All Featured
The Invisible Side of Design
smashingmag
297
50k
Raft: Consensus for Rubyists
vanstee
136
6.6k
The Cult of Friendly URLs
andyhume
78
6k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
228
52k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
13
1.9k
Docker and Python
trallard
40
3.1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
664
120k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
231
17k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
290
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
46
2.1k
Fireside Chat
paigeccino
32
3k
Transcript
Scala and Akka app on Kubernetes In ChatWork ScalaؔSummit 2017
2017/09/09
ࣗݾհ 2017/09/09 © ChatWork All rights reserved. 2 • ྛɹେհ
Twitter: @hayasshi_ GitHub: hayasshi • ChatWorkגࣜձࣾ αʔόʔαΠυΤϯδχΞ ScalaϓϩμΫτ୲ • Scalaྺ4͘Β͍ 2013Ґ͔Β৮Γ࢝ΊΔ ۀͰΨοπϦ2015͔Β
νϟοτϫʔΫʹ͍ͭͯ © ChatWork All rights reserved. 3 2017/09/09 • ϏδωενϟοταʔϏε
άϧʔϓνϟοτɾλεΫཧɾϑΝΠϧڞ༗ɾϏσΦ௨ • ಋೖࣾ 147,000ࣾҎ্ • ྦྷܭϝοηʔδ 20ԯ Ҏ্ (20178݄࣌)
'BMDPOʹ͍ͭͯ © ChatWork All rights reserved. 4 2017/09/09 • ScalaMatsuri
2017 ChatWorkͷScala࠾༻ϓϩμΫτ “Falcon” ϦϦʔε·Ͱͷࣦഊͱޭͷྺ࢙ https://speakerdeck.com/j5ik2o/history-of-falcon-the-way-to-production-release • AWS Dev Day Tokyo 2017 ChatWorkͷ৽ϝοηʔδϯάγεςϜΛࢧ͑Δٕज़ https://speakerdeck.com/j5ik2o/chatworkfalsexin-metusezingusisutemuwozhi-eruji-shu • DataWorks Summit https://dataworkssummit.com/san-jose-2017/sessions/worldwide-scalable-and- resilient-messaging-services-by-cqrs-and-event-sourcing-using-akka-kafka-streams- and-hbase/ • Kafka Summit https://kafka-summit.org/sessions/worldwide-scalable-resilient-messaging-services- kafka-kafka-streams/
ࠓ͓ͳ͢͠Δ͜ͱ © ChatWork All rights reserved. 5 2017/09/09 • ChatWorkͰͷKubernetesͷར༻ʹ͍ͭͯ
ͳͥKubernetesΛಋೖͨ͠ͷ͔ ͲͷΑ͏ʹScalaΞϓϦΛϏϧυͯ͠σϓϩΠ͍ͯ͠Δ͔ ͲͷΑ͏ͳϝϦοτ͕͔͋ͬͨ • ChatWorkͰͷΞϓϦέʔγϣϯϝτϦΫε ͳͥϝτϦΫεΛͱ͍ͬͯΔͷ͔ ͲͷΑ͏ʹScalaΞϓϦͷϝτϦΫεΛͱ͍ͬͯΔͷ͔ ͲͷΑ͏ͳϝτϦΫεΛͱ͍ͬͯΔͷ͔
,VCFSOFUFT © ChatWork All rights reserved. 6 2017/09/09
,VCFSOFUFTͱ © ChatWork All rights reserved. 7 2017/09/09 • ίϯςφΦʔέετϨʔγϣϯπʔϧ
࣮ߦڥͰ͋Δϗετ܈Λ·ͱΊ(ΫϥελԽ) ίϯςφͷӡ༻ཧΛߦͬͯ͘ΕΔ
,VCFSOFUFTͱ © ChatWork All rights reserved. 8 2017/09/09 • ΞϓϦέʔγϣϯ”Pod”ͱ͍ΘΕΔ୯ҐͰཧ͞ΕΔ
͍͔ͭ͘ͷΞϓϦͱϘϦϡʔϜΛ·ͱΊΔ • “Deployment”ͱ͍͏ΈͰɺಉҰछྨͷ”Pod”ͷඋల ։ͷίϯτϩʔϧԽΛཧͰ͖Δ →ϫϯίϚϯυͰεέʔϧͰ͖ͯศར
ͳͥ,VCFSOFUFTΛಋೖͨ͠ͷ͔ © ChatWork All rights reserved. 9 2017/09/09 • Πϯϑϥ໘ͷ՝
ڥߏஙσϓϩΠʹ͓͚ΔΠϯϑϥνʔϜͷίετ͕ߴ͍ ͕ଟ͘ɺεϐʔσΟʔʹରԠ͕Ͱ͖ͳ͍ঢ়ଶͩͬͨ • ͜ΕΒΛղܾ͢ΔͨΊΞϓϦέʔγϣϯ։ൃऀ͕ΞϓϦͷӡ༻ߦ͍͘͢͢Δ DevOpsͷਪਐ ಋೖલ ಋೖޙ ڥߏங ΠϯϑϥνʔϜ ΠϯϑϥʴΞϓϦ ϦϦʔεɾσϓϩΠ ΠϯϑϥνʔϜ ΞϓϦνʔϜ Πϯϑϥӡ༻ ΠϯϑϥνʔϜ ΠϯϑϥνʔϜ ΞϥʔτରԠ ΠϯϑϥνʔϜ ΠϯϑϥʴΞϓϦ
σϓϩΠΠϝʔδ © ChatWork All rights reserved. 10 2017/09/09 • ίϯςφΠϝʔδͷ࡞
sbt-native-packager • ConcourseCIͰҰ࿈ͷλεΫΛύΠϓϥΠϯԽ • ΞϓϦέʔγϣϯ։ൃऀσϓϩΠͷఆٛΛ࡞͠ύΠϓϥΠϯʹઃఆ͢Δ͚ͩ
,VCFSOFUFTಋೖʹΑΔϝϦοτ © ChatWork All rights reserved. 11 2017/09/09 • ΞϓϦέʔγϣϯ։ൃऀ͕ࣗͨͪͰ
ΞϓϦέʔγϣϯͷӡ༻ཧΛߦ͑ΔΑ͏ʹͳͬͨ • DevOpsͷਪਐʹΑΓগͣͭ͠จԽ͕Ͱ͖͖ͯͨ • ΞϓϦέʔγϣϯͷΦϖϨʔγϣϯ ಛʹσϓϩΠεέʔϧΠϯɾΞτ͕ඇৗʹָʹͳͬͨ • KubernetesͷπʔϧͰίϚϯυΛྲྀ͚ͩ͢
ΞϓϦέʔγϣϯϝτϦΫε © ChatWork All rights reserved. 12 2017/09/09
ͳͥϝτϦΫεΛऔΔඞཁ͕͋Δͷ͔ © ChatWork All rights reserved. 13 2017/09/09 • ChatWorkͰେ͖͘3ͭͷతͰऔಘ
• ҟৗݕ • ো࣌ͷݪҼௐࠪ • ΞϓϦέʔγϣϯͷνϡʔχϯά
ͳͥϝτϦΫεΛऔΔඞཁ͕͋Δͷ͔ © ChatWork All rights reserved. 14 2017/09/09 • ChatWorkͰେ͖͘3ͭͷతͰऔಘ
• ҟৗݕ • ো࣌ͷݪҼௐࠪ • ΞϓϦέʔγϣϯͷνϡʔχϯά ֎͔Βݟͯ ҙຯͷ͋ΔϝτϦΫε ෦ͷϝτϦΫε
ͲͷΑ͏ʹϝτϦΫεΛऔ͍ͬͯΔ͔ © ChatWork All rights reserved. 15 2017/09/09 • Kamon
ΞϓϦ෦ͷϝτϦΫεऩू • Datadog ϞχλϦϯάαʔϏε • PagerDuty Ξϥʔτ௨
ΞϓϦέʔγϣϯͷ֎͔Βݟͯҙຯͷ͋ΔϝτϦΫε © ChatWork All rights reserved. 16 2017/09/09 • ॲཧ࣌ؒ
• ୯Ґ࣌ؒ͋ͨΓͷॲཧྔ(εϧʔϓοτ) • ΤϥʔϨʔτ • ͖͍͠Λઃ͚ɺͦΕΛ͑ͨ࣌ʹΞϥʔτ͢Δ͜ͱͰɺ ҟৗΛૉૣ͘ݕ͢Δ͜ͱ͕Ͱ͖Δ • جຊతʹΧελϜϝτϦΫεͱͯ͠ɺܭଌ༻ͷϩδοΫΛ ෦ʹࠐΉඞཁ͕͋Δ
• ҟৗ࣌ͷεϧʔϓοτ • ҟৗ࣌ͷॲཧ࣌ؒ © ChatWork All rights reserved. 17
2017/09/09 ΞϓϦέʔγϣϯͷ֎͔Βݟͯҙຯͷ͋ΔϝτϦΫε
• ҰൠతͳઃఆΛ͍ͯ͠Δ • Nؒͷฏۉॲཧ͕࣌ؒ˓˓msΛ͍͑ͯͨ߹ • Nؒͣͬͱ࠷େॲཧ͕࣌ؒ˓˓msΛ͍͑ͯͨ߹ • NؒͷΤϥʔϨʔτ(Τϥʔ / ॲཧ)͕̋%Λ͑
ͨ߹ • ͜ΕҎ֎ʹϝοηʔδΩϡʔʹ͋Δॲཧ͞Ε͍ͯͳ͍ϝο ηʔδͳͲʹ͖͍͠Λ͚ͭͨΓ͍ͯ͠Δ ϝτϦΫεΛ༻͍ͨݕͷ͖͍͠ © ChatWork All rights reserved. 18 2017/09/09
ΞϓϦέʔγϣϯ෦ͷϝτϦΫε 4DBMB © ChatWork All rights reserved. 19 2017/09/09 •
جຊతͳͷ͕த৺ • CPU༻ • ώʔϓ༻ྔ • GCλΠϜɾGCΧϯτɹͳͲ • ಛʹScala໋ΦϒδΣΫτ͕ଟ͘ͳΓ͍͢ͷͰɺ͔ͬ͠ΓGC Ͱճऩ͞Ε͍ͯΔ͔֬ೝ͢Δ • ্هʹϓϥεͯ͠ɺΞϓϦέʔγϣϯͷಛੑʹΑͬͯɺ ݟΔ͖ϝτϦΫεΛݕ౼͢Δ
ΞϓϦέʔγϣϯ෦ͷϝτϦΫε © ChatWork All rights reserved. 20 2017/09/09 • ͳΜ͔࠷ॳྑͦ͞͏͚ͩͲ
• ؾ͕͍ͭͨΒ༨༟͕ͳ͘ͳ͍ͬͯͨ • খ͞ͳϝϞϦϦʔΫ͕͋ΓظؒՔಇͰṧഭ →JVMͷΫϥεɾώετάϥϜΛग़ྗͯ͠ൃ֮ →ϞχλϦϯάେ͕ͩैདྷͷJVMཧπʔϧͰͷ֬ೝॏཁ
ΞϓϦέʔγϣϯ෦ͷϝτϦΫε "LLB © ChatWork All rights reserved. 21 2017/09/09 •
Akkaجຊతʹฒߦॲཧ • AkkaͷฒߦॲཧΛ͑͞͞ΔΈͰ͋ΔDispatcher·ΘΓͷ ϝτϦΫεΛ͓͑͞Δ • εϨουϓʔϧ →ϓʔϧͷશͯͷεϨου͕ৗʹΞΫςΟϒʹͳͬͯ ͍ͳ͍͔ • ϝʔϧϘοΫε →ಛఆͷDispatcherͷϝʔϧϘοΫεʹϝʔϧ͕ཹ͠ ͍ͯͳ͍͔
ΞϓϦέʔγϣϯ෦ͷϝτϦΫε "LLB © ChatWork All rights reserved. 22 2017/09/09 •
Kamon͕ऩूͯ͘͠ΕΔ • εϨουΛ͍Δঢ়ଶ͕ଓ͍ͨΓɺActorͷϝʔϧϘοΫεʹϝοηʔδ͕ཹ ͢Δ͜ͱ͕ଟ͘ͳΔͱɺνϡʔχϯάͷαΠϯ • blocking-ioΛߦ͏ॲཧܭࢉͷଟ͍ॲཧͷDispatcherΛผʹ͢ΔͳͲ
·ͱΊ © ChatWork All rights reserved. 23 2017/09/09 • KubernetesΛಋೖͨ͜͠ͱͰ
• DevOpsͷจԽ͕গͣͭ͠Ͱ͖͖ͯͨ • ΞϓϦέʔγϣϯͷӡ༻ཧָ͕ʹͳͬͨ • ϝτϦΫε • తʹΑͬͯऔಘ͢ΔϝτϦΫεΛݟۃΊΔ • ऩूπʔϧͱΫϥυϞχλϦϯάαʔϏεͰ ӡ༻ཧΞϓϦνϡʔχϯάָ͕ʹͳͬͨ
8FBSF)JSJOH © ChatWork All rights reserved. 24 2017/09/09 ҰॹʹνϟοτϫʔΫΛྑ͍͖͍ͯͨ͘͠ΤϯδχΞืूʂ IUUQDPSQDIBUXPSLDPNKBSFDSVJUFOHJOFFS
͓͠·͍ © ChatWork All rights reserved. 25 2017/09/09