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
230
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
200
Big Data para Gerentes de Projetos
celsocrivelaro
0
45
FileSystems em Ruby com FUSE
celsocrivelaro
2
55
Padrões e Boas Práticas de Teste de Tela
celsocrivelaro
0
390
Projeto de APIs
celsocrivelaro
0
140
Testing Network Conditions with ToxiProxy
celsocrivelaro
1
330
Testing Network Conditions with ToxiProxy
celsocrivelaro
0
77
Separando as regras de negócios do Rails
celsocrivelaro
0
170
InfluxDB + Grafana
celsocrivelaro
0
240
Other Decks in Technology
See All in Technology
GoとアクターモデルでES+CQRSを実践! / proto_actor_es_cqrs
ytake
1
150
スタートアップにおける組織設計とスクラムの長期戦略 / Scrum Fest Kanazawa 2024
yoshikiiida
13
3.6k
AOAI Dev Day - Opening Session
yoshidashingo
2
430
可視化プラットフォームGrafanaの基本と活用方法の全て
hamadakoji
0
230
技術負債による事業の失敗はなぜ起こるのか / Why do business failures due to technical debt occur?
i35_267
0
190
OSSコミットしてZennの課題を解決した話
dyoshikawa1993
0
150
「単なる OAuth 2.0 を認証に使うと、車が通れるほどのどでかいセキュリティー・ホールができる」のか検証してみた
terara
0
380
[2024最新版]AWS Control Towerを使ったセキュアなマルチアカウント環境の作り方
hiashisan
0
270
Flutter研修【MIXI 24新卒技術研修】
mixi_engineers
PRO
0
160
セキュリティ研修 Day1【MIXI 24新卒技術研修】
mixi_engineers
PRO
0
150
20240717_イケコパ代表Copilot_in_Teams会社でこう使ってます
ponponmikankan
2
430
[I/O Extended Android 2024] What`s new in Android 2024
kyeongwan
0
220
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
17
8.7k
Imperfection Machines: The Place of Print at Facebook
scottboms
262
13k
The Invisible Side of Design
smashingmag
294
50k
Testing 201, or: Great Expectations
jmmastey
33
6.9k
Debugging Ruby Performance
tmm1
71
11k
What's new in Ruby 2.0
geeforr
338
31k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
19k
Fontdeck: Realign not Redesign
paulrobertlloyd
79
5.1k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
149
45k
The Pragmatic Product Professional
lauravandoore
29
6.1k
How to name files
jennybc
67
96k
Building a Modern Day E-commerce SEO Strategy
aleyda
25
6.7k
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