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
バクラクのドキュメント解析技術と実データにおける課題 / layerx-ccc-winter-2024
shimacos
2
1.1k
Fanstaの1年を大解剖! 一人SREはどこまでできるのか!?
syossan27
2
170
大幅アップデートされたRagas v0.2をキャッチアップ
os1ma
2
540
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
360
Google Cloud で始める Cloud Run 〜AWSとの比較と実例デモで解説〜
risatube
PRO
0
110
AI時代のデータセンターネットワーク
lycorptech_jp
PRO
1
290
普通のエンジニアがLaravelコアチームメンバーになるまで
avosalmon
0
110
新機能VPCリソースエンドポイント機能検証から得られた考察
duelist2020jp
0
230
DUSt3R, MASt3R, MASt3R-SfM にみる3D基盤モデル
spatial_ai_network
2
190
どちらを使う?GitHub or Azure DevOps Ver. 24H2
kkamegawa
0
880
サービスでLLMを採用したばっかりに振り回され続けたこの一年のあれやこれや
segavvy
2
500
PHPからGoへのマイグレーション for DMMアフィリエイト
yabakokobayashi
1
170
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
95
5.2k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
What's in a price? How to price your products and services
michaelherold
243
12k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
Agile that works and the tools we love
rasmusluckow
328
21k
Navigating Team Friction
lara
183
15k
RailsConf 2023
tenderlove
29
940
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