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
620
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.7k
Elixir and Ecto
vanstee
5
1k
Bootstrap
vanstee
8
850
HTTP API Design for iOS Applications
vanstee
11
720
Consensus: An Introduction to Raft
vanstee
21
3.3k
Convergent Replicated Data Types
vanstee
4
900
Pour Over Brewing Method
vanstee
1
430
Map Reduce & Ruby
vanstee
10
930
Other Decks in Programming
See All in Programming
信頼性の目標を誰も求めてない
shubox
0
500
DynamoDBの基礎を振り返りながらベクトル検索機能を理解する
musan
3
280
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
150
数年滞っていたダークモード対応をおよそ2週間で完了させる
chigichan24
0
700
Go × SIMDで高速化するベクトル検索 ~ルーフラインモデルでSIMDが効く境界を探れ! ~
po3rin
1
200
RSSとCodexを使ってX投稿自動化してみた
ochtum
0
110
Deep dive into the select statement (GopherCon UK)
jespino
0
170
AIとGame Jamで、ゲームを完成させた話
takahirosaeki
0
120
PHPプロジェクトの結合バランスを可視化する #php_night
kajitack
0
230
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
230
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
320
Laravelのアプリケーションをどこにデプロイするか #ツナギメオフライン.9
akase244
0
120
Featured
See All Featured
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
330
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
Balancing Empowerment & Direction
lara
6
1.3k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
230
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
490
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
It's Worth the Effort
3n
188
29k
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