More Related Content
The Actor Model - Towards Better Concurrency
Actor Patterns and NATS - Boulder Meetup
Actor model : A Different Concurrency Approach
A gentle introduction into AKKA and the actor model
Model with actors and implement with Akka
Introduction to Actor Model and Akka
Actor-based concurrency and Akka Fundamentals
Hybrid concurrency patterns
What's hot
Introduction to Actor Model and Akka
Akka.net versus microsoft orleans
Ruby is dying. What languages are cool now?
Web development basics (Part-6)
Online game server on Akka.NET (NDC2016)
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
Combining the strength of erlang and Ruby
Actors Set the Stage for Project Orleans
Functional Programming in Clojure
Erlang factory SF 2011 "Erlang and the big switch in social games"
Introduction to the Actor Model
Viewers also liked
Building Reactive Systems with Akka (in Java 8 or Scala)
Real Time Data Streaming using Kafka & Storm
Is ruby logger thread(process)-safe? at RubyConf 2013
Threading and Concurrency in Ruby
Concurrent Programming with Ruby and Tuple Spaces
JRuby on Rails and Thread Safety
Scaling Ruby with Evented I/O - Ruby underground
Akka - Developing SEDA Based Applications
Multi-threaded web crawler in Ruby
Ruby Concurrency and EventMachine
Real-Time Analytics with Kafka, Cassandra and Storm
Similar to Actors and Threads
Ruby Concurrency Realities
Ruby's Concurrency Management: Now and Future
Concurrency patterns in Ruby
Concurrency patterns in Ruby
Concurrent programming with Celluloid (MWRC 2012)
Concurrency: Rubies, Plural
Concurrency: Rubies, plural
Bringing Concurrency to Ruby - RubyConf India 2014
Clojure's take on concurrency
Comparing implementations of the actor model
Processes and Threads in Windows Vista
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
Recently uploaded
Towards a Vibrant AI Hardware Accelerator Ecosystem, invited talk at the 4th ...
AI Vector Search Best Practices Multicloud Feb 2026
Shape your dream product by Rotational Moulding.ppsx
When-Security-Decisions-Are-Made-Too-Late.pptx.pdf
Logical Optimal Actions – Towards Knowledge-based Reinforcement Learning with...
homag-panel-dividing-sawteq-s-160-brochure-asia-south-america-2025-03-En.pdf
How AI Can Help Platform Engineers Build Better Platforms
Chapter 6 Authentication and Access Control.pdf
UiPath Modern Automation Playbook -Session 2
GDG Cloud Southlake #49: Pradeep R Kumar: Implications of Agentic AI for Iden...
Empower your IT team with cloud-based PC management using Dell Management Por...
GenerationAI_Paris_2025_Architecting_Intelligence.pdf
Growing-Communities-Growing-Security-Risks.pptx.pdf
Workflow and decision Automation with Flowable
Microsoft Azure News - February 2026 - BAUG
What Is Reality Drift? A Framework for Understanding Modern System Misalignment
Preserve workload integrity during cross-architecture migration - Summary
HOW TO OVERCOME THE THREATS OF ARTIFICIAL INTELLIGENCE AGAINST HUMANITY.pdf
The-Illusion-of-Security-in-Gated-Communities.pptx.pdf
The Transformative Technology in Contemporary Businesses
Actors and Threads
- 1.
- 2.
Who Am I? •Numerous gems (dalli, memcache-client, rack-fiber_pool, connection_pool, etc) • Scalability/Performance guy • Fibers and EventMachine • Technical Lead at Carbon Five
- 3.
- 4.
What This Isn’t •Threads vs Events vs Processes • Threads won’t make you love Java
- 5.
Definitions • Concurrency -performing two operations in tandem (e.g. two web requests) • Parallelism - performing two operations literally at the same time (requires two cores) Concurrent Parallel
- 6.
- 7.
The problem isalways communication (true in the real world too!)
- 8.
- 10.
- 11.
- 12.
Threads • Much moreefficient than processes • Communication mechanism? • Variables! • POSIX 1995
- 13.
- 14.
- 15.
End Goals • RuntimeEfficiency isn’t the only goal! • Remember Fun? • Ease of Development is huge
- 16.
- 17.
- 18.
Lock Benchmark # Results: Ruby 1.9.2, GIL means no parallel threading # user system total real # single locked 4.310000 0.010000 4.320000 ( 4.311850) # threaded locked 4.230000 0.080000 4.310000 ( 4.307405) # # Results: JRuby 1.6.3, parallel threads mean massive lock contention # user system total real # single locked 4.080000 0.000000 4.080000 ( 4.080000) # threaded locked 17.109000 0.000000 17.109000 ( 17.109000) Context Switching!
- 19.
- 20.
What can wedo? • Look to other languages • Go • Scala • Erlang
- 21.
- 22.
Goroutines • Really likethis model • Maps well to a distributed model • Backed by a pool of threads
- 23.
Actors • unit ofexecution • has a mailbox • You just send it a message, e.g. • actor << { :amount => 11.99 }
- 24.
- 25.
- 26.
- 27.
- 28.
Celluloid • Tony Arcieri(Revactor, Reia) • https://github.com/tarcieri/celluloid • OO Actors • Asynchronous method invocation • Mix of Threads and Fibers
- 29.
- 30.
- 31.
girl_friday • yours truly •http://github.com/mperham/girl_friday • Background processing pools • Parallel batch operations • More functional than OO • Thread-based
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
STM • Software TransactionalMemory • All mutation via transactions • Provide ACI (not ACID) guarantees • See Clojure (and Cloby!)
- 38.
Atomic Instructions • SincePentium (1993) • XCHG - swap registers or register/ memory • CPMXCHG - Compare And Set (‘CAS’)
- 39.
- 40.
Atomic Benchmark # Results:JRuby 1.6.3 # user system total real # single atomic 2.041000 0.000000 2.041000 ( 2.041000) # threaded atomic 0.978000 0.000000 0.978000 ( 0.979000) 2 cores = 2x speedup!
- 41.
- 42.
- 43.
Concurrency It’s always hard! Modern languages should support tools and APIs that scale well AND are developer-friendly.
- 44.
To Do • Needstandard Actor API • Concurrent data structures • STM impl for Ruby (via JRuby?) • Multiverse
- 45.
Further Reading • Kilim- Actors for Java • Disruptor - concurrency without locks • Actors in Scala • Concurrency in Erlang
- 46.
Thank You! Questions? @mperham http://mikeperham.com http://blog.carbonfive.com PS We’re hiring!