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
Celluloid & DCell
Search
Patrick Van Stee
July 11, 2012
Programming
610
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
141
7.6k
Elixir and Ecto
vanstee
5
1k
Bootstrap
vanstee
8
840
HTTP API Design for iOS Applications
vanstee
11
720
Consensus: An Introduction to Raft
vanstee
21
3.2k
Convergent Replicated Data Types
vanstee
4
880
Pour Over Brewing Method
vanstee
1
420
Map Reduce & Ruby
vanstee
10
910
Other Decks in Programming
See All in Programming
関数型プログラミングのメリットって何だろう?
wanko_it
0
180
SREは、MCPとSRE Agentをこう使え!
kazumax55
0
150
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
0
110
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
230
AIを活用したE2Eテスト実装効率化のあゆみ / ebisu-mobile-14-kotetu
kotetuco
0
170
Welcome to the "Parametricity" 🏙️ − Generic だけど Specific な世界 −
guvalif
PRO
1
170
yield再入門 #phpcon
o0h
PRO
0
440
はてなアカウント基盤 State of the Union
cockscomb
1
1.3k
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
170
act2-costs.pdf
sumedhbala
0
110
Foundation Models frameworkで画像分析
ryodeveloper
1
120
Apache Hive: Toward a Cloud Native Lakehouse
okumin
0
130
Featured
See All Featured
AI: The stuff that nobody shows you
jnunemaker
PRO
8
830
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
320
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
180
How to Ace a Technical Interview
jacobian
281
24k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.2k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
360
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
350
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
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