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
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.5k
Elixir and Ecto
vanstee
5
1k
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
420
Map Reduce & Ruby
vanstee
10
900
Other Decks in Programming
See All in Programming
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
3
450
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
110
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
310
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
160
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
330
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
780
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
140
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
130
3Dシーンの圧縮
fadis
1
770
New "Type" system on PicoRuby
pocke
1
920
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
600
並列実装の現場、2ヶ月間実務でAIを使い倒したAIもPCも私も限界が近い
ming_ayami
0
130
Featured
See All Featured
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.7k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
230
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
430
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
230
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
840
Accessibility Awareness
sabderemane
1
140
Facilitating Awesome Meetings
lara
57
7k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
It's Worth the Effort
3n
188
29k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
620
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