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
Patrick Van Stee
July 11, 2012
Programming
640
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Celluloid & DCell
Patrick Van Stee
July 11, 2012
Transcript
26 slides
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
More Decks by Patrick Van Stee
See All by Patrick Van Stee
Raft: Consensus for Rubyists
vanstee
143
7.9k
Elixir and Ecto
vanstee
5
1k
Bootstrap
vanstee
8
870
HTTP API Design for iOS Applications
vanstee
11
740
Consensus: An Introduction to Raft
vanstee
21
3.4k
Convergent Replicated Data Types
vanstee
4
920
Pour Over Brewing Method
vanstee
1
460
Map Reduce & Ruby
vanstee
10
950
Other Decks in Programming
See All in Programming
Kotlin Fest 2026: Kotlin コンパイラに Contribute してみよう! - Kotlin/Wasm で深い再帰を書けるようにした話
ternbusty
1
430
TS 7.0 で baseUrl が使えなくなった今、パスエイリアスをどうするか
bicstone
2
860
Growing PicoRuby's Ecosystem on ESP32
yuuu
2
150
R言語プログラミング
profjoesuzuki
0
130
テストだけで見つかる? Rubyでつくるメソッド発掘器
izawa
0
170
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
510
はじめてのKubernetesコントリビューション
nasa9084
0
330
テスト駆動開発から学ぶ 達人プログラマーの型 / TechRAMEN 2026 Conference
a_okui
0
3.2k
正解の無い問題を 「できるだけ上手く」解く ヒューリスティックで感性を磨こう。〜現実課題をプログラミングで解きあうコミュニティについて〜
allegrogiken
0
120
Lean で手続き的プログラム の証明が書けるようになった
inoueasei
11
5.6k
느린 네트워크와 저사양 디바이스 사용자를 위한 웹뷰 로딩 시간 개선기
kmkim
1
270
Agentic AI with the Power of Jakarta EE
ivargrimstad
0
240
Featured
See All Featured
Digital Ethics as a Driver of Design Innovation
axbom
PRO
2
570
For a Future-Friendly Web
brad_frost
184
11k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
340
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
6
970
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
77k
RailsConf 2023
tenderlove
30
1.6k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
340
The Invisible Side of Design
smashingmag
301
52k
A designer walks into a library…
pauljervisheath
211
25k
Bash Introduction
62gerente
615
220k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
890
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
360