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
0
250
Actor Model in Ruby
Talk in RubyConf Brazil 2016
Celso Crivelaro
September 23, 2016
Tweet
Share
More Decks by Celso Crivelaro
See All by Celso Crivelaro
Sistemas de Recomendação
celsocrivelaro
2
220
Big Data para Gerentes de Projetos
celsocrivelaro
0
58
FileSystems em Ruby com FUSE
celsocrivelaro
2
65
Padrões e Boas Práticas de Teste de Tela
celsocrivelaro
0
410
Projeto de APIs
celsocrivelaro
0
160
Testing Network Conditions with ToxiProxy
celsocrivelaro
1
380
Testing Network Conditions with ToxiProxy
celsocrivelaro
0
81
Separando as regras de negócios do Rails
celsocrivelaro
0
180
InfluxDB + Grafana
celsocrivelaro
0
260
Other Decks in Technology
See All in Technology
『バイトル』CTOが語る! AIネイティブ世代と切り拓くモノづくり組織
dip_tech
PRO
1
110
実装で解き明かす並行処理の歴史
zozotech
PRO
1
690
職種別ミートアップで社内から盛り上げる アウトプット文化の醸成と関係強化/ #DevRelKaigi
nishiuma
2
160
Azure Well-Architected Framework入門
tomokusaba
1
350
Escaping_the_Kraken_-_October_2025.pdf
mdalmijn
0
160
成長自己責任時代のあるきかた/How to navigate the era of personal responsibility for growth
kwappa
4
310
[Codex Meetup Japan #1] Codex-Powered Mobile Apps Development
korodroid
0
120
GoでもGUIアプリを作りたい!
kworkdev
PRO
0
130
リーダーになったら未来を語れるようになろう/Speak the Future
sanogemaru
0
380
Reflections of AI: A Trilogy in Four Parts (GOTO; Copenhagen 2025)
ondfisk
0
110
プロダクトのコードから見るGoによるデザインパターンの実践 #go_night_talk
bengo4com
1
2.3k
社内報はAIにやらせよう / Let AI handle the company newsletter
saka2jp
8
1.3k
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
79
6k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
127
53k
Designing for Performance
lara
610
69k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.7k
Building an army of robots
kneath
306
46k
Facilitating Awesome Meetings
lara
56
6.6k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
Optimizing for Happiness
mojombo
379
70k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.2k
jQuery: Nuts, Bolts and Bling
dougneiner
65
7.9k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.6k
Building a Scalable Design System with Sketch
lauravandoore
463
33k
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