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
490
とある会社のビルドデプロイ / 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
550
Other Decks in Technology
See All in Technology
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
290
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
2
3.2k
Terraform Stacks入門 #HashiTalks
msato
0
350
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
110
Taming you application's environments
salaboy
0
180
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
150
OCI Security サービス 概要
oracle4engineer
PRO
0
6.5k
データプロダクトの定義からはじめる、データコントラクト駆動なデータ基盤
chanyou0311
2
280
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
[FOSS4G 2024 Japan LT] LLMを使ってGISデータ解析を自動化したい!
nssv
1
210
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
870
Lexical Analysis
shigashiyama
1
150
Featured
See All Featured
Being A Developer After 40
akosma
86
590k
How STYLIGHT went responsive
nonsquared
95
5.2k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Happy Clients
brianwarren
98
6.7k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
The Pragmatic Product Professional
lauravandoore
31
6.3k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
16k
Building Adaptive Systems
keathley
38
2.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