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
600
4
Share
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.5k
Elixir and Ecto
vanstee
5
990
Bootstrap
vanstee
8
840
HTTP API Design for iOS Applications
vanstee
11
710
Consensus: An Introduction to Raft
vanstee
21
3.2k
Convergent Replicated Data Types
vanstee
4
870
Pour Over Brewing Method
vanstee
1
410
Map Reduce & Ruby
vanstee
10
900
Other Decks in Programming
See All in Programming
JavaDoc 再入門
nagise
0
250
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
180
TSKaigi 2026 TypeScriptバックエンドのオブザーバビリティ戦略 — Datadog × NestJSの実践
taiseiyamamotoan
1
220
TypeSpec で繋ぐ複数プロダクトの型安全
maroon8021
1
320
Technical Debt: Understanding it Rightly, Engaging it Rightly #LaravelLiveJP
shogogg
0
190
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
230
TSKaigi2026-静的解析への投資がAI時代のコード品質を支える ── カスタムESLintルールの設計と運用
hayatokudou
7
1.3k
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
120
技術記事、AIに書かせるか、自分で書くか? 〜それでも私が自分の手で書く理由〜 / #QiitaConference
jnchito
2
1.2k
SPMマルチモジュールで テストカバレッジを取得する技法
yosshi4486
0
140
Claspは野良GASの夢をみるか
takter00
0
160
Swiftのレキシカルスコープ管理
kntkymt
0
210
Featured
See All Featured
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
200
The Cult of Friendly URLs
andyhume
79
6.9k
Darren the Foodie - Storyboard
khoart
PRO
3
3.4k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.2k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
120
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
22k
Practical Orchestrator
shlominoach
191
11k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
190
How to train your dragon (web standard)
notwaldorf
97
6.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