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
Actor Model in Ruby
Search
Celso Crivelaro
September 23, 2016
Technology
270
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Actor Model in Ruby
Talk in RubyConf Brazil 2016
Celso Crivelaro
September 23, 2016
More Decks by Celso Crivelaro
See All by Celso Crivelaro
Sistemas de Recomendação
celsocrivelaro
2
240
Big Data para Gerentes de Projetos
celsocrivelaro
0
72
FileSystems em Ruby com FUSE
celsocrivelaro
2
75
Padrões e Boas Práticas de Teste de Tela
celsocrivelaro
0
450
Projeto de APIs
celsocrivelaro
0
180
Testing Network Conditions with ToxiProxy
celsocrivelaro
1
400
Testing Network Conditions with ToxiProxy
celsocrivelaro
0
92
Separando as regras de negócios do Rails
celsocrivelaro
0
190
InfluxDB + Grafana
celsocrivelaro
0
270
Other Decks in Technology
See All in Technology
FDEの心得
noriakioji
5
6.4k
도구에서 동료까지: 10년차 AI 스타트업의 AI 적응기
inureyes
PRO
1
330
ハッカソンで入賞した話 @ Findy LT
asari194617
0
1.5k
フィジカルAIの知識ゼロの僕でも AIを使えばここまでできた
tatsuya1970
0
150
なぜ Temporal の大小比較には compare しかないのか / Why Does Temporal Only Have compare() for Comparisons
kazukihayase
1
200
MIXIで活躍できるエンジニアを 若手社員目線で考えてみる
mixi_engineers
PRO
0
140
平文パスワードはログに“残り” ── 肝心の侵入は“痕跡すら残らない”
kuroneko13
0
120
LLM Internals: 언어 모델의 계보와 알고리즘 진화 (2023~2026)
inureyes
PRO
1
890
AI for Science時代を切り開く、政府の次世代HPC戦略の展望
gpuunite_official
0
230
Kiro Crew で始める マルチエージェント開発
miu_crescent
PRO
0
170
私がブラウザを自作したくなった理由
supurazako
1
280
長期運営で肥大化したExcelマスターデータの解消に向けた移行事例
gree_tech
PRO
0
350
Featured
See All Featured
WENDY [Excerpt]
tessaabrams
11
39k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.1k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
240
New Earth Scene 8
popppiees
3
2.5k
エンジニアに許された特別な時間の終わり
watany
108
250k
Raft: Consensus for Rubyists
vanstee
141
7.6k
My Coaching Mixtape
mlcsv
0
270
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
950
Design in an AI World
tapps
1
290
Technical Leadership for Architectural Decision Making
baasie
3
520
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Heart Work Chapter 1 - Part 1
lfama
PRO
8
36k
Transcript
Actor Model in Ruby Celso Crivelaro @celsocrivelaro http://crivelaro.me 1
DEVELOPER @ PROFESSOR @
None
My problem
Authorization APIs SMTP Protocol Strange Protocol Strange Lib 5
Strange Protocol / Strange Lib => Unmaintained Bad documentation Troubleshooting
was impossible
Authorization APIs TCP/IP Custom Protocol SMTP Protocol
High Concurrency ~ 1000 connections Fault Tolerant Easy TCP Server
API
None
Actors Reactor 10
Actor Model Theory
Actor 1 Mailbox Actor 2 Mailbox Actor 3 Mailbox
Actors are similar to Objects
Send messages to each other Asynchronous Actors Objects Synchronous Create
new ones Isolated Share memory Keep state
Actors can be distributed 15
Actor 1 Mailbox Actor 2 Mailbox Actor 3 Mailbox
Fault Tolerant
Let it crash philosophy
Actor 1 Mailbox Actor 2 Mailbox Actor 3 Mailbox Actor
4 Mailbox A4 is linked to A2 A2 is warned when A4 crashes A2 takes an action (restart A4) Avoid defensive programming
Who implements Actors 20
Pykka
None
Celluloid Actors Ruby Objects Same structure from classes Runs over
threads / fibers Futures and Pools Sync / Async Methods
None
25
When Actor crashes…
None
What if another actor could do something?
Supervisors
30
None
Even if an Actor just terminates
None
Actor Supervisor Restart Actor Warn other Supervisor Callbacks Avoid begin…
rescue... / if Actions:
Must be finished to be CG’ed 35
None
Futures
None
Pool
Res 1 Res 2 Res 3 Pool Res 1 40
None
http://www.mikeperham.com/2015/10/14/should-you-use-celluloid/
None
Actors Reactor
Reactor Pattern 45
Handler 1 Handler 2 Dispatcher Handler 3 Handles service request
Delivered concurrently to handlers Demultiplexing Event Event Event
https://github.com/celluloid/nio4r
None
None
Server Celluloid:IO Supervisor 50
None
None
Important
Mutant Data Structure
Actor 1 Mailbox Actor 2 Mailbox Actor 3 Mailbox Microservices
55
Evaluate the best concurrency model Celluloid Documentation
References
http://www.brianstorti.com/the-actor-model/
None
https://www.sitepoint.com/an-introduction-to-celluloid-part-i/
https://github.com/celluloid/celluloid-io
http://queroserdevlocaweb.com.br/
Thank you! @celsocrivelaro Slides at http://crivelaro.me