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
550
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
140
7k
Elixir and Ecto
vanstee
5
940
Bootstrap
vanstee
8
780
HTTP API Design for iOS Applications
vanstee
11
630
Consensus: An Introduction to Raft
vanstee
22
3k
Convergent Replicated Data Types
vanstee
4
760
Pour Over Brewing Method
vanstee
1
350
Map Reduce & Ruby
vanstee
10
800
Other Decks in Programming
See All in Programming
Claude Code派?Gemini CLI派? みんなで比較LT会!_20250716
junholee
1
690
知って得する@cloudflare_vite-pluginのあれこれ
chimame
1
120
テスト駆動Kaggle
isax1015
1
870
AIコーディングエージェント全社導入とセキュリティ対策
hikaruegashira
11
6.8k
AWS Summit Japan 2024と2025の比較/はじめてのKiro、今あなたは岐路に立つ
satoshi256kbyte
1
240
テスターからテストエンジニアへ ~新米テストエンジニアが歩んだ9ヶ月振り返り~
non0113
2
240
なぜあなたのオブザーバビリティ導入は頓挫するのか
ryota_hnk
0
350
状態遷移図を書こう / Sequence Chart vs State Diagram
orgachem
PRO
2
250
The Evolution of Enterprise Java with Jakarta EE 11 and Beyond
ivargrimstad
0
440
AIのメモリー
watany
11
910
レベル1の開発生産性向上に取り組む − 日々の作業の効率化・自動化を通じた改善活動
kesoji
1
350
PHPカンファレンス関西2025 基調講演
sugimotokei
5
920
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
Code Reviewing Like a Champion
maltzj
524
40k
Done Done
chrislema
184
16k
How to train your dragon (web standard)
notwaldorf
96
6.1k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
Music & Morning Musume
bryan
46
6.7k
The Straight Up "How To Draw Better" Workshop
denniskardys
235
140k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.1k
Docker and Python
trallard
45
3.5k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
5.9k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
50
5.5k
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