SlideShare a Scribd company logo
Threads and
  Events in
Harmony with
  Celluloid
   Kyle Drake
Hi, I’m Kyle Drake. I
work at Geoloqi Esri.

We built a geofencing
           Text


and real-time location
 streaming platform.
Last year, IText a
              did
talk at KRTConf.
I was really into
pure event-driven
           Text
(reactor pattern
based) architecture.
EventMachine,
    Twisted,
    Node.js
• Event-driven
         Text


• No threads
• One CPU core
• Process Spawning
I released
sinatra-synchrony,
so I could use
          Text


EventMachine
without callbacks.
Since then, I’ve
         Text
changed my mind.
I’m really not a fan
of EventMachine
            Text


anymore.
EventMachine is
• A frankenstein - guts the ruby internals
• Not in active development
                         Text
• Makes non-blocking IO block
• Requires special code from Ruby libraries
• Hard to use in an OOP way
• Is really difficult to work with
• Poorly documented
Ruby developers
need to stop using
EventMachine. It’s
           Text


the wrong
direction.
Check this
benchmark
     Text


out:
Text




http://rhaas.blogspot.com/2012/04/did-i-say-32-cores-how-about-64.html
Predictions:
More Cores.
A lot more.
Predictions:
More libraries
      =
more memory
Will process
spawning work
   forever?

  It might.
It might not.

Thousands of
   cores?
Hybrid concurrency patterns
Ruby MRI:
Global Interpreter Lock
   (single CPU core)

  Rubinius and JRuby:
    Full threading
 (multiple CPU cores)

~20KB per thread
We’re not finding
 a lot of thread
 safety issues in
      Ruby.
“Threading is
   hard”
Threading is
   not an
 intention!
Let’s fix it by
    abstracting
threads into how
  humans think!
Hybrid concurrency patterns
http://celluloid.io
• Developed by Tony Arcieri
• Actor Pattern for Ruby
• Lots of inspiration from Erlang
Each actor is a
concurrent object
running in its own
      thread
Hybrid concurrency patterns
Hybrid concurrency patterns
First “Killer App”:

     Sidekiq
   Mike Perham
Hybrid concurrency patterns
Don’t get me
wrong. Event-
driven is still
 awesome.
“..seasoned engineers are
using a mix of threaded,
event-based, and
alternative concurrency
approaches like Actors”

      - Alex Payne
What if we could
combine threads
  and reactor
 patterns.. and
    actors?!
https://github.com/celluloid/celluloid-io
• One reactor pattern per Celluloid object
• Multiple reactors? No problem!
• Doesn’t mess with code outside of actor
• Utilizes all CPU cores (using JRuby and Rubinius)
• Websockets, messaging systems, your hugely
successful blog
You don't have to
choose between
  threaded and
   evented IO!
Let’s get
distributed.
"I thought of objects being like
     biological cells and/or
   individual computers on a
     network, only able to
 communicate with messages"
           - Alan   Kay
Guess who was really
  into distributed
 network objects?
Hybrid concurrency patterns
NeXT experimented
   with distributed
objects in the mid 90s.

NeXT was way ahead
   of its time.
"Objects can message objects transparently
that live on other machines over the network,
    and you don't have to worry about the
networking gunk, and you don't have to worry
  about finding them, and you don't have to
    worry about anything. It's just as if you
  messaged an object that's right next door."

                - Steve Jobs
“Portable Distributed Objects”
https://github.com/celluloid/dcell
 • Objects talk over networks!
 • Uses 0MQ
 • Aware of eachothers’ existence
 • Distributed gossip protocol
 • Web UI
 • In the early stages, very promising
CODE
EXAMPLES!
Help Us
Build This!
Thanks!
 @kyledrake
kyledrake.net

More Related Content

PDF
Ruby is dying. What languages are cool now?
KEY
Building MapAttack
KEY
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
KEY
Actors and Threads
PPTX
The Actor Model - Towards Better Concurrency
PDF
Actor Patterns and NATS - Boulder Meetup
PDF
Bringing Concurrency to Ruby - RubyConf India 2014
PDF
Model with actors and implement with Akka
Ruby is dying. What languages are cool now?
Building MapAttack
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
Actors and Threads
The Actor Model - Towards Better Concurrency
Actor Patterns and NATS - Boulder Meetup
Bringing Concurrency to Ruby - RubyConf India 2014
Model with actors and implement with Akka

What's hot (20)

PDF
JRuby: Pushing the Java Platform Further
KEY
自分をClojure化する方法
ODP
How to start using Scala
PDF
Culerity - Headless full stack testing for JavaScript
PDF
Ruby in office time reboot
KEY
About Clack
PPTX
Lisp in the Cloud
PDF
Clojure Conj 2014 - Paradigms of core.async - Julian Gamble
PDF
Applying the paradigms of core.async in Clojure and ClojureScript
PDF
Functional Programming in Clojure
PPTX
My month with Ruby
PPTX
Rubykaigi 2017-nishimotz-v6
PDF
Actor model : A Different Concurrency Approach
PDF
How to-node-core
PDF
NodePDX Slides
PDF
Building GUI App with Electron and Lisp
PDF
Kevin Whinnery: Write Better JavaScript
PDF
Starting with Symfony2
PDF
Ruby projects of interest for DevOps
PPTX
ProtoPie with Electron
JRuby: Pushing the Java Platform Further
自分をClojure化する方法
How to start using Scala
Culerity - Headless full stack testing for JavaScript
Ruby in office time reboot
About Clack
Lisp in the Cloud
Clojure Conj 2014 - Paradigms of core.async - Julian Gamble
Applying the paradigms of core.async in Clojure and ClojureScript
Functional Programming in Clojure
My month with Ruby
Rubykaigi 2017-nishimotz-v6
Actor model : A Different Concurrency Approach
How to-node-core
NodePDX Slides
Building GUI App with Electron and Lisp
Kevin Whinnery: Write Better JavaScript
Starting with Symfony2
Ruby projects of interest for DevOps
ProtoPie with Electron
Ad

Similar to Hybrid concurrency patterns (20)

PDF
Un actor (model) per amico - Alessandro Melchiori - Codemotion Milan 2016
PPTX
Seattlerb why jruby
PPTX
Why Play Framework is fast
PPTX
Software Architectures, Week 1 - Monolithic Architectures
PDF
Improving Blockchain Developer Experience (DevX): Where UX meets Developer Tools
PDF
PyData Frankfurt - (Efficient) Data Exchange with "Foreign" Ecosystems
KEY
Ruby Concurrency Realities
PDF
DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
KEY
Mobile Knife Fighting at JSConf US
PDF
Concurrency patterns in Ruby
PDF
Concurrency patterns in Ruby
PPTX
Ruby Concurrency
PDF
Java in High Frequency Trading
PPTX
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
PPTX
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4j
PPTX
Life Beyond Rails: Creating Cross Platform Ruby Apps
PDF
Truly madly deeply parallel ruby applications
PDF
What's Running My Containers? A review of runtimes and standards.
PDF
Soumith Chintala at AI Frontiers: A Dynamic View of the Deep Learning World
PDF
Introduction to Go
Un actor (model) per amico - Alessandro Melchiori - Codemotion Milan 2016
Seattlerb why jruby
Why Play Framework is fast
Software Architectures, Week 1 - Monolithic Architectures
Improving Blockchain Developer Experience (DevX): Where UX meets Developer Tools
PyData Frankfurt - (Efficient) Data Exchange with "Foreign" Ecosystems
Ruby Concurrency Realities
DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
Mobile Knife Fighting at JSConf US
Concurrency patterns in Ruby
Concurrency patterns in Ruby
Ruby Concurrency
Java in High Frequency Trading
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4j
Life Beyond Rails: Creating Cross Platform Ruby Apps
Truly madly deeply parallel ruby applications
What's Running My Containers? A review of runtimes and standards.
Soumith Chintala at AI Frontiers: A Dynamic View of the Deep Learning World
Introduction to Go
Ad

Recently uploaded (20)

PDF
Rare Big Band Arrangers Who Revolutionized Big Band Music in USA.pdf
PDF
Between the Reels and the Revolution Enzo Zelocchi’s Unscripted Path Through ...
PPTX
BULAN K3 NASIONAL PowerPt Templates.pptx
PPTX
Safety_Pharmacology_Tier2_Edibbbbbbbbbbbbbbbable.pptx
PDF
Gess1025.pdfdadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
PDF
Songlyrics.net-website for lyrics song download
PPTX
providenetworksystemadministration.pptxhnnhgcbdjckk
PDF
TAIPANQQ SITUS MUDAH MENANG DAN MUDAH MAXWIN SEGERA DAFTAR DI TAIPANQQ DAN RA...
PDF
Rakshabandhan – Celebrating the Bond of Siblings - by Meenakshi Khakat
PDF
Download FL Studio Crack Latest version 2025
PPTX
wegen seminar ppt.pptxhkjbkhkjjlhjhjhlhhvg
PPTX
SPARSH-SVNITs-Annual-Cultural-Fest presentation for orientation
PPTX
PRECISION AGRICULTURE- 1.pptx for agriculture
DOCX
Lambutchi Calin Claudiu had a discussion with the Buddha about the restructur...
PDF
Keanu Reeves Beyond the Legendary Hollywood Movie Star.pdf
PPT
business model and some other things that
PDF
WKA #29: "FALLING FOR CUPID" TRANSCRIPT.pdf
PDF
My Oxford Year- A Love Story Set in the Halls of Oxford
PPTX
What Makes an Entertainment App Addictive?
PDF
Commercial arboriculture Commercial Tree consultant Essex, Kent, Thaxted.pdf
Rare Big Band Arrangers Who Revolutionized Big Band Music in USA.pdf
Between the Reels and the Revolution Enzo Zelocchi’s Unscripted Path Through ...
BULAN K3 NASIONAL PowerPt Templates.pptx
Safety_Pharmacology_Tier2_Edibbbbbbbbbbbbbbbable.pptx
Gess1025.pdfdadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
Songlyrics.net-website for lyrics song download
providenetworksystemadministration.pptxhnnhgcbdjckk
TAIPANQQ SITUS MUDAH MENANG DAN MUDAH MAXWIN SEGERA DAFTAR DI TAIPANQQ DAN RA...
Rakshabandhan – Celebrating the Bond of Siblings - by Meenakshi Khakat
Download FL Studio Crack Latest version 2025
wegen seminar ppt.pptxhkjbkhkjjlhjhjhlhhvg
SPARSH-SVNITs-Annual-Cultural-Fest presentation for orientation
PRECISION AGRICULTURE- 1.pptx for agriculture
Lambutchi Calin Claudiu had a discussion with the Buddha about the restructur...
Keanu Reeves Beyond the Legendary Hollywood Movie Star.pdf
business model and some other things that
WKA #29: "FALLING FOR CUPID" TRANSCRIPT.pdf
My Oxford Year- A Love Story Set in the Halls of Oxford
What Makes an Entertainment App Addictive?
Commercial arboriculture Commercial Tree consultant Essex, Kent, Thaxted.pdf

Hybrid concurrency patterns

Editor's Notes