Hybrid concurrency patterns

Kyle Drake
Kyle DrakeProfessional Cyberpunk at Net Brew Ventures
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
1 of 45

Recommended

Ruby is dying. What languages are cool now? by
Ruby is dying. What languages are cool now?Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?Michał Konarski
2.9K views73 slides
Building MapAttack by
Building MapAttackBuilding MapAttack
Building MapAttackKyle Drake
1.6K views49 slides
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony by
Fast, concurrent ruby web applications with EventMachine and EM::SynchronyFast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::SynchronyKyle Drake
9.7K views28 slides
Actors and Threads by
Actors and ThreadsActors and Threads
Actors and Threadsmperham
16K views46 slides
The Actor Model - Towards Better Concurrency by
The Actor Model - Towards Better ConcurrencyThe Actor Model - Towards Better Concurrency
The Actor Model - Towards Better ConcurrencyDror Bereznitsky
25.1K views60 slides
Actor Patterns and NATS - Boulder Meetup by
Actor Patterns and NATS - Boulder MeetupActor Patterns and NATS - Boulder Meetup
Actor Patterns and NATS - Boulder MeetupApcera
2.4K views17 slides

More Related Content

What's hot

JRuby: Pushing the Java Platform Further by
JRuby: Pushing the Java Platform FurtherJRuby: Pushing the Java Platform Further
JRuby: Pushing the Java Platform FurtherCharles Nutter
1.5K views41 slides
自分をClojure化する方法 by
自分をClojure化する方法自分をClojure化する方法
自分をClojure化する方法fukamachi
1.6K views44 slides
How to start using Scala by
How to start using ScalaHow to start using Scala
How to start using ScalaNgoc Dao
2.2K views33 slides
Culerity - Headless full stack testing for JavaScript by
Culerity - Headless full stack testing for JavaScriptCulerity - Headless full stack testing for JavaScript
Culerity - Headless full stack testing for JavaScriptThilo Utke
896 views43 slides
Ruby in office time reboot by
Ruby in office time rebootRuby in office time reboot
Ruby in office time rebootKentaro Goto
1.7K views47 slides
About Clack by
About ClackAbout Clack
About Clackfukamachi
58.7K views38 slides

What's hot(20)

JRuby: Pushing the Java Platform Further by Charles Nutter
JRuby: Pushing the Java Platform FurtherJRuby: Pushing the Java Platform Further
JRuby: Pushing the Java Platform Further
Charles Nutter1.5K views
自分をClojure化する方法 by fukamachi
自分をClojure化する方法自分をClojure化する方法
自分をClojure化する方法
fukamachi1.6K views
How to start using Scala by Ngoc Dao
How to start using ScalaHow to start using Scala
How to start using Scala
Ngoc Dao2.2K views
Culerity - Headless full stack testing for JavaScript by Thilo Utke
Culerity - Headless full stack testing for JavaScriptCulerity - Headless full stack testing for JavaScript
Culerity - Headless full stack testing for JavaScript
Thilo Utke896 views
Ruby in office time reboot by Kentaro Goto
Ruby in office time rebootRuby in office time reboot
Ruby in office time reboot
Kentaro Goto1.7K views
About Clack by fukamachi
About ClackAbout Clack
About Clack
fukamachi58.7K views
Lisp in the Cloud by Mike Travers
Lisp in the CloudLisp in the Cloud
Lisp in the Cloud
Mike Travers5.7K views
Clojure Conj 2014 - Paradigms of core.async - Julian Gamble by Julian Gamble
Clojure Conj 2014 - Paradigms of core.async - Julian GambleClojure Conj 2014 - Paradigms of core.async - Julian Gamble
Clojure Conj 2014 - Paradigms of core.async - Julian Gamble
Julian Gamble1.5K views
Applying the paradigms of core.async in Clojure and ClojureScript by Julian Gamble
Applying the paradigms of core.async in Clojure and ClojureScriptApplying the paradigms of core.async in Clojure and ClojureScript
Applying the paradigms of core.async in Clojure and ClojureScript
Julian Gamble1.3K views
Functional Programming in Clojure by Troy Miles
Functional Programming in ClojureFunctional Programming in Clojure
Functional Programming in Clojure
Troy Miles623 views
Actor model : A Different Concurrency Approach by Emre Akış
Actor model : A Different Concurrency ApproachActor model : A Different Concurrency Approach
Actor model : A Different Concurrency Approach
Emre Akış1.2K views
NodePDX Slides by Kyle Drake
NodePDX SlidesNodePDX Slides
NodePDX Slides
Kyle Drake2.8K views
Building GUI App with Electron and Lisp by fukamachi
Building GUI App with Electron and LispBuilding GUI App with Electron and Lisp
Building GUI App with Electron and Lisp
fukamachi20.4K views
Starting with Symfony2 by Kevin Bond
Starting with Symfony2Starting with Symfony2
Starting with Symfony2
Kevin Bond1.9K views
Ruby projects of interest for DevOps by Ricardo Sanchez
Ruby projects of interest for DevOpsRuby projects of interest for DevOps
Ruby projects of interest for DevOps
Ricardo Sanchez1.2K views
ProtoPie with Electron by Scotty Kim
ProtoPie with ElectronProtoPie with Electron
ProtoPie with Electron
Scotty Kim1.3K views

Similar to Hybrid concurrency patterns

Un actor (model) per amico - Alessandro Melchiori - Codemotion Milan 2016 by
Un actor (model) per amico - Alessandro Melchiori - Codemotion Milan 2016Un actor (model) per amico - Alessandro Melchiori - Codemotion Milan 2016
Un actor (model) per amico - Alessandro Melchiori - Codemotion Milan 2016Codemotion
446 views25 slides
Seattlerb why jruby by
Seattlerb why jrubySeattlerb why jruby
Seattlerb why jrubysnacktime
321 views9 slides
Why Play Framework is fast by
Why Play Framework is fastWhy Play Framework is fast
Why Play Framework is fastLegacy Typesafe (now Lightbend)
56.1K views33 slides
CSP: Huh? And Components by
CSP: Huh? And ComponentsCSP: Huh? And Components
CSP: Huh? And ComponentsDaniel Fagnan
245 views34 slides
Software Architectures, Week 1 - Monolithic Architectures by
Software Architectures, Week 1 - Monolithic ArchitecturesSoftware Architectures, Week 1 - Monolithic Architectures
Software Architectures, Week 1 - Monolithic ArchitecturesAngelos Kapsimanis
501 views65 slides
Improving Blockchain Developer Experience (DevX): Where UX meets Developer Tools by
Improving Blockchain Developer Experience (DevX): Where UX meets Developer ToolsImproving Blockchain Developer Experience (DevX): Where UX meets Developer Tools
Improving Blockchain Developer Experience (DevX): Where UX meets Developer ToolsErik Trautman
729 views54 slides

Similar to Hybrid concurrency patterns(20)

Un actor (model) per amico - Alessandro Melchiori - Codemotion Milan 2016 by Codemotion
Un actor (model) per amico - Alessandro Melchiori - Codemotion Milan 2016Un actor (model) per amico - Alessandro Melchiori - Codemotion Milan 2016
Un actor (model) per amico - Alessandro Melchiori - Codemotion Milan 2016
Codemotion446 views
Seattlerb why jruby by snacktime
Seattlerb why jrubySeattlerb why jruby
Seattlerb why jruby
snacktime321 views
CSP: Huh? And Components by Daniel Fagnan
CSP: Huh? And ComponentsCSP: Huh? And Components
CSP: Huh? And Components
Daniel Fagnan245 views
Software Architectures, Week 1 - Monolithic Architectures by Angelos Kapsimanis
Software Architectures, Week 1 - Monolithic ArchitecturesSoftware Architectures, Week 1 - Monolithic Architectures
Software Architectures, Week 1 - Monolithic Architectures
Angelos Kapsimanis501 views
Improving Blockchain Developer Experience (DevX): Where UX meets Developer Tools by Erik Trautman
Improving Blockchain Developer Experience (DevX): Where UX meets Developer ToolsImproving Blockchain Developer Experience (DevX): Where UX meets Developer Tools
Improving Blockchain Developer Experience (DevX): Where UX meets Developer Tools
Erik Trautman729 views
PyData Frankfurt - (Efficient) Data Exchange with "Foreign" Ecosystems by Uwe Korn
PyData Frankfurt - (Efficient) Data Exchange with "Foreign" EcosystemsPyData Frankfurt - (Efficient) Data Exchange with "Foreign" Ecosystems
PyData Frankfurt - (Efficient) Data Exchange with "Foreign" Ecosystems
Uwe Korn422 views
CSP: Huh? And Components by Daniel Fagnan
CSP: Huh? And ComponentsCSP: Huh? And Components
CSP: Huh? And Components
Daniel Fagnan395 views
Ruby Concurrency Realities by Mike Subelsky
Ruby Concurrency RealitiesRuby Concurrency Realities
Ruby Concurrency Realities
Mike Subelsky1.5K views
DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem by FITC
DownTheRabbitHole.js – How to Stay Sane in an Insane EcosystemDownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
DownTheRabbitHole.js – How to Stay Sane in an Insane Ecosystem
FITC673 views
Mobile Knife Fighting at JSConf US by Brian LeRoux
Mobile Knife Fighting at JSConf US Mobile Knife Fighting at JSConf US
Mobile Knife Fighting at JSConf US
Brian LeRoux2K views
Concurrency patterns in Ruby by ThoughtWorks
Concurrency patterns in RubyConcurrency patterns in Ruby
Concurrency patterns in Ruby
ThoughtWorks1.7K views
Concurrency patterns in Ruby by ThoughtWorks
Concurrency patterns in RubyConcurrency patterns in Ruby
Concurrency patterns in Ruby
ThoughtWorks764 views
Java in High Frequency Trading by Viktor Sovietov
Java in High Frequency TradingJava in High Frequency Trading
Java in High Frequency Trading
Viktor Sovietov2.1K views
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4j by Kevin Watters
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4jRobotics, Search and AI with Solr, MyRobotLab, and Deeplearning4j
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4j
Kevin Watters140 views
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L... by Lucidworks
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
Lucidworks471 views
Life Beyond Rails: Creating Cross Platform Ruby Apps by Tristan Gomez
Life Beyond Rails: Creating Cross Platform Ruby AppsLife Beyond Rails: Creating Cross Platform Ruby Apps
Life Beyond Rails: Creating Cross Platform Ruby Apps
Tristan Gomez322 views
Truly madly deeply parallel ruby applications by Hari Krishnan‎
Truly madly deeply parallel ruby applicationsTruly madly deeply parallel ruby applications
Truly madly deeply parallel ruby applications
Hari Krishnan‎467 views
What's Running My Containers? A review of runtimes and standards. by Phil Estes
What's Running My Containers? A review of runtimes and standards.What's Running My Containers? A review of runtimes and standards.
What's Running My Containers? A review of runtimes and standards.
Phil Estes435 views

Recently uploaded

"Losing It After Every Show" by
"Losing It After Every Show""Losing It After Every Show"
"Losing It After Every Show"Joshua McMaster
11 views287 slides
Durley House.pdf by
Durley House.pdfDurley House.pdf
Durley House.pdfvictusx1499
7 views2 slides
FA kala Ilam specialist in Pakistan , sifli jadu expert +92-3217066670 #amilb... by
FA kala Ilam specialist in Pakistan , sifli jadu expert +92-3217066670 #amilb...FA kala Ilam specialist in Pakistan , sifli jadu expert +92-3217066670 #amilb...
FA kala Ilam specialist in Pakistan , sifli jadu expert +92-3217066670 #amilb...#Astrologer
5 views29 slides
Top 5 educational movie by
Top 5 educational movieTop 5 educational movie
Top 5 educational movieSunjedaAkterSumaiya
5 views5 slides
Mann-Mayal-Novel-By-Aileen-Noor-Episode2.pdf by
Mann-Mayal-Novel-By-Aileen-Noor-Episode2.pdfMann-Mayal-Novel-By-Aileen-Noor-Episode2.pdf
Mann-Mayal-Novel-By-Aileen-Noor-Episode2.pdfnovelsmag
8 views17 slides
RESUME by
RESUMERESUME
RESUMEbvtp649ry8
9 views1 slide

Recently uploaded(13)

FA kala Ilam specialist in Pakistan , sifli jadu expert +92-3217066670 #amilb... by #Astrologer
FA kala Ilam specialist in Pakistan , sifli jadu expert +92-3217066670 #amilb...FA kala Ilam specialist in Pakistan , sifli jadu expert +92-3217066670 #amilb...
FA kala Ilam specialist in Pakistan , sifli jadu expert +92-3217066670 #amilb...
#Astrologer5 views
Mann-Mayal-Novel-By-Aileen-Noor-Episode2.pdf by novelsmag
Mann-Mayal-Novel-By-Aileen-Noor-Episode2.pdfMann-Mayal-Novel-By-Aileen-Noor-Episode2.pdf
Mann-Mayal-Novel-By-Aileen-Noor-Episode2.pdf
novelsmag8 views
Fun Session 3 Movie Quiz.pptx by ssuserd156e61
Fun Session 3 Movie Quiz.pptxFun Session 3 Movie Quiz.pptx
Fun Session 3 Movie Quiz.pptx
ssuserd156e6113 views
Gwyneth Paltrow rejects Nepo Baby as her name reason by danealbwp228
Gwyneth Paltrow rejects Nepo Baby as her name reasonGwyneth Paltrow rejects Nepo Baby as her name reason
Gwyneth Paltrow rejects Nepo Baby as her name reason
danealbwp2287 views
Mann-Mayal-Novel-By-Aileen-Noor-Episode2.pdf by novelsmag
Mann-Mayal-Novel-By-Aileen-Noor-Episode2.pdfMann-Mayal-Novel-By-Aileen-Noor-Episode2.pdf
Mann-Mayal-Novel-By-Aileen-Noor-Episode2.pdf
novelsmag7 views

Hybrid concurrency patterns

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n