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
Akka Streamsの縮退処理を用いた耐障害性の実現 〜 広告のリアルタイムオークションの...
Search
Ikuo Matsumura
March 26, 2016
Programming
1
2.4k
Akka Streamsの縮退処理を用いた耐障害性の実現 〜 広告のリアルタイムオークションの事例 〜
「Scala将軍達の後の祭り」での発表資料です。
http://scala-syogun-matsuri.connpass.com/event/28124/
Ikuo Matsumura
March 26, 2016
Tweet
Share
More Decks by Ikuo Matsumura
See All by Ikuo Matsumura
論文紹介: "A Unified Search Federation System Based on Online User Feedback"
ikuo
0
99
Other Decks in Programming
See All in Programming
MCPでVibe Working。そして、結局はContext Eng(略)/ Working with Vibe on MCP And Context Eng
rkaga
5
1.8k
Ruby Parser progress report 2025
yui_knk
1
290
パッケージ設計の黒魔術/Kyoto.go#63
lufia
3
420
MCPで実現するAIエージェント駆動のNext.jsアプリデバッグ手法
nyatinte
7
1k
レガシープロジェクトで最大限AIの恩恵を受けられるようClaude Codeを利用する
tk1351
4
1.6k
Processing Gem ベースの、2D レトロゲームエンジンの開発
tokujiros
2
120
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
210
Ruby×iOSアプリ開発 ~共に歩んだエコシステムの物語~
temoki
0
230
モバイルアプリからWebへの横展開を加速した話_Claude_Code_実践術.pdf
kazuyasakamoto
0
300
Updates on MLS on Ruby (and maybe more)
sylph01
1
180
さようなら Date。 ようこそTemporal! 3年間先行利用して得られた知見の共有
8beeeaaat
2
1.3k
Kiroの仕様駆動開発から見えてきたAIコーディングとの正しい付き合い方
clshinji
1
200
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
95
14k
Statistics for Hackers
jakevdp
799
220k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Agile that works and the tools we love
rasmusluckow
330
21k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3.1k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.4k
The Invisible Side of Design
smashingmag
301
51k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
61k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
Designing for humans not robots
tammielis
253
25k
Making Projects Easy
brettharned
117
6.4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Transcript
Akka StreamsͷॖୀॲཧΛ༻͍ͨ োੑͷ࣮ݱ ʙ ࠂͷϦΞϧλΠϜΦʔΫγϣϯͷࣄྫ ʙ
ࣗݾհ @ikuo (Ikuo Matsumura) 2008~ ࠐܥͷࢄγϛϡϨʔγϣϯͷઃܭ։ൃͳͲ; C++, MATLAB IBM Research
- Tokyo 2011~ ϨγϐӫཆՁͷࣗಈܭࢉͷઃܭ։ൃͳͲ; Ruby/Rails, Treetop Cookpad, Inc. 2014~ SSP/RTBΦʔΫγϣϯͷઃܭ։ൃͳͲ; Scala/Akka CyberAgent, Inc. CA ProFit-X team
ࠂͷϦΞϧλΠϜΦʔΫγϣϯ (RTB) ߴ͍Մ༻ੑཁ݅ɿࢭΊΒΕͳ͍ ˍ ͬͯ͘Εͳ͍ ෆ࣮֬ͳڥɿ֎෦ͷଟͷೖࡳݩ(DSP)ʹৗ࣌ଓ ೖࡳ͕શͯἧΘͳ͍͜ͱڐ༰Ͱ͖Δ
ଟͷ֎෦ଓͷো͔ΒγεςϜΛकΓ͍ͨ * Photo by FEMA/Joselyne Augus5no; A home in Gilchrist,
Texas, designed to resist flood waters survived Hurricane Ike in 2008.
֎෦ଓͷোͱΞϓϩʔν ʮͪ͜Βʯͷҟৗɿଓͷ෦ঢ়ଶͷҟৗ ྫɿHTTP ΫϥΠΞϯτͷActorͷঢ়ଶҟৗ → SupervisorʹΑΔҟৗݕͱActorͷ࠶ىಈ ʮ͋ͪΒʯͷҟৗɿϨΠςϯγѱԽɾແԠԽ ྫɿଓઌͷܭࢉࢿݯଳҬͷṧഭ → ॖୀ
(fallback)ɿॏཁͰͳ͍ϝοηʔδΛࣺͯͯ ɹɹϝϞϦރׇ (OutOfMemoryError) Λ͙
ରࡦ1: BoundedMailboxΛ͏ bounded-mailbox { mailbox-type = "akka.dispatch.NonBlockingBoundedMailbox" } ✅ ᷓΕͨΒϝοηʔδࣺͯΔͷͰϝϞϦރׇ͛Δ
❌ Ձͷߴ͍ϝοηʔδ͕ࣺͯΒΕΔ ؒʹ߹͏ݟࠐΈͷখ͍͞ೖࡳཁٻ͕ͬͯ͠·͏
ରࡦ2: ༏ઌ͖ͭͷBoundedMailboxΛ͏ bounded-mailbox { mailbox-type = "akka.dispatch.BoundedStablePriorityMailbox" mailbox-push-timeout-time = 0s
} ✅ ᷓΕͨΒϝοηʔδࣺͯΔͷͰϝϞϦރׇ͛Δ ✅ Ձͷߴ͍ϝοηʔδΛͤΔ
❌ ద༻࿙ΕͷActor͕͋ΔͱϝϞϦރׇ͛ͳ͍ UnboundedͳϝʔϧϘοΫεͷActor͕͋Γɺ͕ͦ͜ ʹͳΔͱϝʔϧϘοΫε͕ᷓΕΔ
ରࡦ3: Akka StreamsΛ͏ ϝοηʔδִนϊʔυ (bulkhead) Λհͯ͠௨৴ϊʔυ (subscriber) ʹBroadcastɻ ௨৴ϊʔυ֎෦ཁٻྃ·ͰϝοηʔδΛ্ྲྀʹཁٻ͠ͳ͍ɻ
ִนϊʔυ (bulkhead) val bulkhead = Flow .apply[MyMessage] .buffer( bulkheadBufferSize, OverflowStrategy.dropHead
) όοϑΝͷ࠷େαΠζΛ͑Δͱɺݹ͍ϝοηʔδ ΛࣺͯΔ ( dropHead )
௨৴ϊʔυ (subscriber) val subscriberA = Sink(ActorSubscriber[MyMessage](actorA)) class ProxyA extends Actor
with ActorSubscriber { def receive = { case OnNext(msg: MyMessage) => hostConnector .ask(httpReq(msg)) .map(...) .onComplete(request(1)) ... ֎෦ཁٻͷྃΛ͔ͬͯΒ࣍ͷϝοηʔδΛ্ྲྀ (bulkhead) ʹཁٻ͢ΔͷͰɺ֎෦ཁٻͷաఔͷͲ͕͜ ʹͳͬͯϝʔϧϘοΫε͕ᷓΕͳ͍
Akka StreamsΛ͏ ✅ ᷓΕͨΒϝοηʔδࣺͯΔͷͰϝϞϦރׇ͛Δ ✅ Ձͷߴ͍ϝοηʔδΛͤΔ ✅ ཁҼ͕Ҡಈ࣮ͯ֬͠ʹॖୀͰ͖Δ
CA ProFit-X • 20153݄ʹϦϦʔε • ॳ͔ΒAkka StreamsʹΑΔ ॖୀॲཧΛࠐΈ • ݱࡏඵؒ1ສ݅ͷϦΞϧλ
ΠϜΦʔΫγϣϯΛ҆ఆͯ͠ ॲཧ
·ͱΊ Akka StreamsΛ֎෦ଓͷॖୀͷͨΊʹ͏͜ͱ Ͱɺʮͬͯ͘Εͳ͍ʯڥͰ֎෦ଓͷোʢੑ ೳྼԽ ) ͔ΒγεςϜΛकΔྫΛհ͠·ͨ͠ɻ ॲཧͱผͷ োੑ ͷଆ໘ͰAkka
StreamsΛ ׆༻͢Δྫͷ1ͭͱͯ͠ɺࢀߟʹͳΕ͍Ͱ͢ɻ