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.5k
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
500
とある会社のビルドデプロイ / A certain company's application building
hayasshi
0
320
Scala / refined で`型く`表明プログラミング / Programing with type level assertion
hayasshi
2
830
Akka Typed - 型安全にメッセージパッシングする! / Akka Typed - typesafe messaging
hayasshi
6
2.5k
AWS Dev Day Challenge (2018-11-02) - ChatWork Suita
hayasshi
2
560
Other Decks in Technology
See All in Technology
KubeCon NA 2024 Recap / Running WebAssembly (Wasm) Workloads Side-by-Side with Container Workloads
z63d
1
240
生成AIのガバナンスの全体像と現実解
fnifni
1
180
ゼロから創る横断SREチーム 挑戦と進化の軌跡
rvirus0817
2
260
生成AIをより賢く エンジニアのための RAG入門 - Oracle AI Jam Session #20
kutsushitaneko
4
210
Qiita埋め込み用スライド
naoki_0531
0
860
レンジャーシステムズ | 会社紹介(採用ピッチ)
rssytems
0
150
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
250
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
100
LINEヤフーのフロントエンド組織・体制の紹介【24年12月】
lycorp_recruit_jp
0
530
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
140
OpenShift Virtualizationのネットワーク構成を真剣に考えてみた/OpenShift Virtualization's Network Configuration
tnk4on
0
130
スタートアップで取り組んでいるAzureとMicrosoft 365のセキュリティ対策/How to Improve Azure and Microsoft 365 Security at Startup
yuj1osm
0
210
Featured
See All Featured
Designing for humans not robots
tammielis
250
25k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Raft: Consensus for Rubyists
vanstee
137
6.7k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
How GitHub (no longer) Works
holman
311
140k
YesSQL, Process and Tooling at Scale
rocio
169
14k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Rails Girls Zürich Keynote
gr2m
94
13k
Optimising Largest Contentful Paint
csswizardry
33
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