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
4
590
Celluloid & DCell
Patrick Van Stee
July 11, 2012
Tweet
Share
More Decks by Patrick Van Stee
See All by Patrick Van Stee
Raft: Consensus for Rubyists
vanstee
141
7.4k
Elixir and Ecto
vanstee
5
980
Bootstrap
vanstee
8
820
HTTP API Design for iOS Applications
vanstee
11
680
Consensus: An Introduction to Raft
vanstee
21
3.1k
Convergent Replicated Data Types
vanstee
4
840
Pour Over Brewing Method
vanstee
1
390
Map Reduce & Ruby
vanstee
10
870
Other Decks in Programming
See All in Programming
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
140
ロボットのための工場に灯りは要らない
watany
10
2.8k
RAGでハマりがちな"Excelの罠"を、データの構造化で突破する
harumiweb
9
2.8k
OTP を自動で入力する裏技
megabitsenmzq
0
100
grapheme_strrev関数が採択されました(あと雑感)
youkidearitai
PRO
1
220
Claude Code の Skill で複雑な既存仕様をすっきり整理しよう
yuichirokato
1
370
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
200
AIとペアプロして処理時間を97%削減した話 #pyconshizu
kashewnuts
1
230
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
460
Codexに役割を持たせる 他のAIエージェントと組み合わせる実務Tips
o8n
4
1.3k
maplibre-gl-layers - 地図に移動体たくさん表示したい
kekyo
PRO
0
260
2026年は Rust 置き換えが流行る! / 20260220-niigata-5min-tech
girigiribauer
0
230
Featured
See All Featured
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
100
The SEO Collaboration Effect
kristinabergwall1
0
390
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
250
RailsConf 2023
tenderlove
30
1.4k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
Prompt Engineering for Job Search
mfonobong
0
180
How to make the Groovebox
asonas
2
2k
WENDY [Excerpt]
tessaabrams
9
36k
Ethics towards AI in product and experience design
skipperchong
2
220
Become a Pro
speakerdeck
PRO
31
5.8k
Abbi's Birthday
coloredviolet
2
5.3k
ラッコキーワード サービス紹介資料
rakko
1
2.6M
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