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.5k
AWS Dev Day Challenge (2018-11-02) - ChatWork Suita
hayasshi
2
550
Other Decks in Technology
See All in Technology
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
600
アジャイルチームがらしさを発揮するための目標づくり / Making the goal and enabling the team
kakehashi
3
150
【令和最新版】AWS Direct Connectと愉快なGWたちのおさらい
minorun365
PRO
5
760
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
Zennのパフォーマンスモニタリングでやっていること
ryosukeigarashi
0
180
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
DynamoDB でスロットリングが発生したとき/when_throttling_occurs_in_dynamodb_short
emiki
0
260
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
Engineer Career Talk
lycorp_recruit_jp
0
190
生成AIが変えるデータ分析の全体像
ishikawa_satoru
0
170
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Unsuck your backbone
ammeep
668
57k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Teambox: Starting and Learning
jrom
133
8.8k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
430
Measuring & Analyzing Core Web Vitals
bluesmoon
4
130
Automating Front-end Workflow
addyosmani
1366
200k
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