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
Celluloid & DCell
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Patrick Van Stee
July 11, 2012
Programming
620
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Celluloid & DCell
Patrick Van Stee
July 11, 2012
More Decks by Patrick Van Stee
See All by Patrick Van Stee
Raft: Consensus for Rubyists
vanstee
142
7.7k
Elixir and Ecto
vanstee
5
1k
Bootstrap
vanstee
8
850
HTTP API Design for iOS Applications
vanstee
11
720
Consensus: An Introduction to Raft
vanstee
21
3.3k
Convergent Replicated Data Types
vanstee
4
900
Pour Over Brewing Method
vanstee
1
430
Map Reduce & Ruby
vanstee
10
930
Other Decks in Programming
See All in Programming
AI × TiDD / 2026.09.05 Redmine 大阪
tokudiro
1
170
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
7.3k
市販E-Readerを乗っ取れ 〜Embedded Swiftで電子ペーパーガジェットを制御する〜
trickart
0
190
一人だけ、Kiroが静止する日
hideg
0
110
AIエージェント時代のコードレビューを設計する
nogu66
6
2.7k
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
5
3.2k
AGENTS.md Is Not Enough:Build Skills, Don't Download Them
lx_t
0
120
Security issues being discussed on Web Platforms
petamoriken
0
960
AHC070解法紹介
eijirou
0
120
Intent as Code
shoppingjaws
6
1k
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
560
Are APIs Still Relevant in the AI Era?
soyuka
0
250
Featured
See All Featured
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
430
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
510
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
280
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
450
Leo the Paperboy
mayatellez
10
2.3k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
370
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Rails Girls Zürich Keynote
gr2m
96
14k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.2k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Into the Great Unknown - MozCon
thekraken
41
2.7k
Transcript
Celluloid DCell &
@vanstee github.com/vanstee Patrick Van Stee highgroove.com
@tarcieri Revactor Reia nio4r Cryptosphere cool.io
brew install zeromq gem install dcell Setup
Celluloid General purpose concurrency framework for Ruby built on the
Actor Model
class Counter attr_reader :count def initialize @count = 0 end
def increment @count += 1 end end
class Counter attr_reader :count def initialize @count = 0 @mutex
= Mutex.new end def increment @mutex.synchronize do @count += 1 end end end
Threads are hard!
class Counter include Celluloid attr_reader :count def initialize @count =
0 end def increment @count += 1 end end
Actor Model
•No shared state •Communicate with messages •Process messages sequentially
class Counter include Celluloid def increment(count, actor) return count if
count < 10000 actor.increment( count + 1, Actor.current ) end end
& Asynchronous Method Calls Futures
counter = Counter.new # returns immediately counter.increment! puts counter.count #
returns immediately future = counter.future :increment puts future.value
module Enumerable def map(&block) futures = map do |item| Celluloid::Future.new(
item, &block ) end futures.map(&:value) end end
Caveats
• The GIL in MRI does not allow parallelism •
Threads and Fibers are expensive • Concurrency is still a hard problem [not really]
DCell
Celluloid General purpose concurrency framework for Ruby built on the
Actor Model DCell Distributed Celluloid over 0MQ
“I thought of objects being like biological cells or individual
computers on a network, only able to communicate with messages. Alan Kay
• Exposes Actors on the Network • Send messages as
you normally would
DRb DCell Threads Actors
Demo
Also Checkout Sidekiq
github.com celluloid/celluloid celluloid/dcell
Hack Night