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
7.1k
Elixir and Ecto
vanstee
5
940
Bootstrap
vanstee
8
790
HTTP API Design for iOS Applications
vanstee
11
630
Consensus: An Introduction to Raft
vanstee
22
3k
Convergent Replicated Data Types
vanstee
4
770
Pour Over Brewing Method
vanstee
1
360
Map Reduce & Ruby
vanstee
10
800
Other Decks in Programming
See All in Programming
Vibe coding コードレビュー
kinopeee
0
440
あまり知られていない MCP 仕様たち / MCP specifications that aren’t widely known
ktr_0731
0
260
AIに安心して任せるためにTypeScriptで一意な型を作ろう
arfes0e2b3c
0
360
一人でAIプロダクトを作るための工夫 〜技術選定・開発プロセス編〜 / I want AI to work harder
rkaga
12
2.6k
実践 Dev Containers × Claude Code
touyu
1
180
20250808_AIAgent勉強会_ClaudeCodeデータ分析の実運用〜競馬を題材に回収率100%の先を目指すメソッドとは〜
kkakeru
0
170
Reactの歴史を振り返る
tutinoko
1
180
CEDEC 2025 『ゲームにおけるリアルタイム通信への QUIC導入事例の紹介』
segadevtech
3
860
CEDEC2025 長期運営ゲームをあと10年続けるための0から始める自動テスト ~4000項目を50%自動化し、月1→毎日実行にした3年間~
akatsukigames_tech
0
130
生成AI、実際どう? - ニーリーの場合
nealle
0
100
プロダクトという一杯を作る - プロダクトチームが味の責任を持つまでの煮込み奮闘記
hiliteeternal
0
450
11年かかって やっとVibe Codingに 時代が追いつきましたね
yimajo
1
260
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
77
9.5k
Speed Design
sergeychernyshev
32
1.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
1k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Practical Orchestrator
shlominoach
190
11k
What's in a price? How to price your products and services
michaelherold
246
12k
Thoughts on Productivity
jonyablonski
69
4.8k
[RailsConf 2023] Rails as a piece of cake
palkan
56
5.8k
Designing for Performance
lara
610
69k
Typedesign – Prime Four
hannesfritz
42
2.8k
Why Our Code Smells
bkeepers
PRO
338
57k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.4k
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