Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Actor Model in Ruby
Search
Celso Crivelaro
September 23, 2016
Technology
280
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
Transcript
63 slides
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
More Decks by Celso Crivelaro
See All by Celso Crivelaro
Sistemas de Recomendação
celsocrivelaro
2
250
Big Data para Gerentes de Projetos
celsocrivelaro
0
80
FileSystems em Ruby com FUSE
celsocrivelaro
2
79
Padrões e Boas Práticas de Teste de Tela
celsocrivelaro
0
470
Projeto de APIs
celsocrivelaro
0
190
Testing Network Conditions with ToxiProxy
celsocrivelaro
1
420
Testing Network Conditions with ToxiProxy
celsocrivelaro
0
96
Separando as regras de negócios do Rails
celsocrivelaro
0
210
InfluxDB + Grafana
celsocrivelaro
0
290
Other Decks in Technology
See All in Technology
「個社」ではなく「業界」の課題を解く AI 対話開発 ー 価値を広げる設計と、価値を守るエンジニアリング ー
ivry_presentationmaterials
3
660
re:Inventを楽しむために、 1日1つ「これが楽しみ」を決めよう
beli68
0
120
Datadog の権限統制 〜Org 統合に向けて調べた注意点 / JDDUG-Meetup_24
visional_engineering_and_design
1
180
gradle-best-practices 使ってみた
mikanichinose
0
150
契約書SaaSにAIエージェントを組み込む
sansantech
PRO
0
180
Claude Codeで新規事業を伸ばせるか? Zennの試行錯誤の記録
wadayusuke
2
240
さようならSSH鍵、こんにちはゼロトラスト ― AIフレンドリーで快適な自宅鯖SSH
atalie2m
14
7.1k
SORACOM × AWS IoT Core でSREする
butadora
0
110
これからのデータエンジニアの役割について考える / Rethinking the Role of Data Engineers in the AI Era
okiyuki99
1
540
Gov-JAWS#9 統合監視機能のマネージドサービス化+AIによる障害時自動調査
fj_yoshimura_kosuke
0
210
Quick Automate | 目指せ Quick マスター 12
inariku
PRO
1
150
AWS Emulator を評価する: 手元で動く AWS の API の仕組み、始め方、確かめ方
inariku
PRO
2
760
Featured
See All Featured
Code Review Best Practice
trishagee
74
20k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
1
300
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.8k
The Invisible Side of Design
smashingmag
301
52k
How to train your dragon (web standard)
notwaldorf
96
6.9k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.3k
Product Roadmaps are Hard
iamctodd
55
13k
So, you think you're a good person
axbom
PRO
2
2.3k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
The SEO Collaboration Effect
kristinabergwall1
1
620
GraphQLとの向き合い方2022年版
quramy
50
15k