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
96
Other Decks in Programming
See All in Programming
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
330
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
130
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
460
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
3
470
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
0
160
Security_for_introducing_eBPF
kentatada
0
110
クリエイティブコーディングとRuby学習 / Creative Coding and Learning Ruby
chobishiba
0
3.9k
テストコード書いてみませんか?
onopon
2
110
testcontainers のススメ
sgash708
1
120
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
270
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
100
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
Featured
See All Featured
The Language of Interfaces
destraynor
154
24k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Automating Front-end Workflow
addyosmani
1366
200k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Making Projects Easy
brettharned
116
5.9k
Facilitating Awesome Meetings
lara
50
6.1k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
111
49k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
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ͭͱͯ͠ɺࢀߟʹͳΕ͍Ͱ͢ɻ