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
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
140
Quine, Polyglot, 良いコード
qnighy
4
650
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
190
CSC509 Lecture 13
javiergs
PRO
0
110
受け取る人から提供する人になるということ
little_rubyist
0
250
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
CSC509 Lecture 12
javiergs
PRO
0
160
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
最新TCAキャッチアップ
0si43
0
190
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Visualization
eitanlees
145
15k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
Become a Pro
speakerdeck
PRO
25
5k
We Have a Design System, Now What?
morganepeng
50
7.2k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
420
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ͭͱͯ͠ɺࢀߟʹͳΕ͍Ͱ͢ɻ