SlideShare a Scribd company logo
CONCURRENCY
AND DISTRIBUTED
SYSTEMS IN JRUBY


       @iconara
speakerdeck.com/u/iconara
          (real time!)
Theo / @iconara
Chief Architect at
big data with Ruby since 2009
MAKING THIS
INTO THIS
big data with Ruby since 2009
APRIL 2011
   stuck
MAY 2011
 let’s try JRuby
JUNE 2011
wrapping Java libraries for fun and for profit
HOTBUNNIES
natural Ruby API for RabbitMQ
JULY 2011
threads are better than processes
JRUBY
JRUBY
J.U.C
(java.util.concurrent)
SHORTCUT
Java Concurrency in Practice
EXECUTORS
 configurable thread pools, a better
abstraction than using Thread directly
thread_pool = Executors.new_fixed_thread_pool(16)

all_the_things.each do |thing|
  thread_pool.submit do
    crunch_crunch_crunch(thing)
  end
end
BLOCKING QUEUES
  easy producer/consumer patterns
J.U.C.ATOMIC
   optimistic locking primitives,
       compare-and-swap,
thread safe non-blocking counters
MORE AWESOMES
   ConcurrentHashMap, CountDownLatch,
ForkJoinPool, Google Guava, LMAX distruptor
TL; DR
use j.u.c and avoid mutable state
     and you’re safe, mostly
THREADS
 enough rope
AUGUST 2011
threads are a mess, let’s try actors
ACTORS
a higher level abstraction of concurrency
AKKA
concurrency library for Scala,
famous actor implementation
MIKKA
Akka wrapper for JRuby
DO ALL THE THINGS
 Programming Concurrency on the JVM
AUGUST 2011
 async systems with no back pressure
mechanism will die of memory starvation
INPUT




AGGREGATION      TIMER




   STATE      PERSISTENCE




                OUTPUT
INPUT




    AGGREGATION      TIMER




!      STATE      PERSISTENCE




                    OUTPUT
AUGUST 2011
   actors are cool, but not really
 worth it when all the arrows in your
flow chart point in the same direction
DIVIDE DIVIDE DIVIDE
run multiple independent, synchronous workers,
     tune to the number of CPUs & IO wait
SEPTEMBER 2011
   blocking all the way down,
  back pressure all the way up
AUGUST 2011
(short rant about MongoDB’s global write lock)
NEW SHINY TOYS
 for building new shiny products
CASSANDRA
distributed database, mostly magic
ColumnFamilyUpdater<String, String> updater = template.createUpdater("a key");
updater.setString("domain", "www.datastax.com");
updater.setLong("time", System.currentTimeMillis());

try {
  template.update(updater);
} catch (HectorException e) {
  // hurgh
}




    CASSANDRA
             very verbose drivers
new_data = {:domain => 'www.datastax.com', :time => Time.now.to_i}
column_family.update('a key', new_data)




         EURYDICE
                    JRuby nails it
STORM
stream processing framework written in Clojure
STORM
(it does the arrows, you do the blobs)
REDSTORM
 Storm for JRuby
YOUR CODE




       DON’T DO
  THIS AT HOME KIDS!
   the key to building concurrent and distributed
systems is to separate what you want to do from the
 concurrent- and distributed-ness, and let someone
                else take care of that
JRUBY IS A SLIPPERY
  SLOPE TO JBOSS
    let there be no doubt about it
SCALING IS HARD
  go to Srdan’s talk tomorrow
KTHXBAI
        @iconara
   github.com/iconara
architecturalatrocities.com
       burtcorp.com

More Related Content

PPTX
RxJS In-Depth - AngularConnect 2015
PDF
Rethink Async With RXJS
PDF
AWS ECSを用いてbatchを動かそう
PDF
Fact-Based Monitoring - PuppetConf 2014
ODP
IPython: The awesome python shell
PPT
ECMAScript 6: A Better JavaScript for the Ambient Computing Era
PPTX
Akka.net versus microsoft orleans
PDF
ES6: The Awesome Parts
RxJS In-Depth - AngularConnect 2015
Rethink Async With RXJS
AWS ECSを用いてbatchを動かそう
Fact-Based Monitoring - PuppetConf 2014
IPython: The awesome python shell
ECMAScript 6: A Better JavaScript for the Ambient Computing Era
Akka.net versus microsoft orleans
ES6: The Awesome Parts

What's hot (10)

PDF
Developing Async Sense
PDF
WebCamp 2016: DevOps. Ярослав Погребняк: Gobetween - новый лоад балансер для ...
PPTX
"Walk in a distributed systems park with Orleans" Евгений Бобров
PPTX
Amazon Web Services EC2 Basics
PDF
WebCamp 2016: DevOps. Николай Дойков: Опыт создания клауда для потокового вид...
PDF
【Unite 2017 Tokyo】C#ジョブシステムによるモバイルゲームのパフォーマンス向上テクニック
PPTX
Project Orleans - Actor Model framework
PDF
Upgrade time ! Java to Kotlin
PDF
Paulien van Alst - Upgrade Time: Choose Java 11 or the "other" one… Kotlin - ...
PDF
Angular & RXJS: examples and use cases
Developing Async Sense
WebCamp 2016: DevOps. Ярослав Погребняк: Gobetween - новый лоад балансер для ...
"Walk in a distributed systems park with Orleans" Евгений Бобров
Amazon Web Services EC2 Basics
WebCamp 2016: DevOps. Николай Дойков: Опыт создания клауда для потокового вид...
【Unite 2017 Tokyo】C#ジョブシステムによるモバイルゲームのパフォーマンス向上テクニック
Project Orleans - Actor Model framework
Upgrade time ! Java to Kotlin
Paulien van Alst - Upgrade Time: Choose Java 11 or the "other" one… Kotlin - ...
Angular & RXJS: examples and use cases
Ad

Similar to Concurrency and Distributed Systems Using JRuby (20)

PDF
Ruby Performance - The Last Mile - RubyConf India 2016
PDF
JRuby on Rails - RoR's Simplicity Meets Java's Class (a case in point)
PDF
Concurrency patterns in Ruby
PDF
Concurrency patterns in Ruby
PDF
Bringing Concurrency to Ruby - RubyConf India 2014
KEY
Actors and Threads
PPT
Rollin onj Rubyv3
PDF
Cassandra Anti-Patterns
PDF
Voldemort Nosql
PDF
Reactive Software Systems
PDF
Everything You Were Taught About Java Is Wrong
PPTX
Concurrent talk
PPTX
Concurrency Constructs Overview
PDF
Dlsecyx pgroammr (Dyslexic Programmer - cool stuff for scaling)
KEY
Modern Java Concurrency (Devoxx Nov/2011)
PPTX
Exploring Ruby on Rails and PostgreSQL
PPTX
Indic threads pune12-typesafe stack software development on the jvm
PDF
The Year of JRuby - RubyC 2018
PDF
JRuby: The Hard Parts
Ruby Performance - The Last Mile - RubyConf India 2016
JRuby on Rails - RoR's Simplicity Meets Java's Class (a case in point)
Concurrency patterns in Ruby
Concurrency patterns in Ruby
Bringing Concurrency to Ruby - RubyConf India 2014
Actors and Threads
Rollin onj Rubyv3
Cassandra Anti-Patterns
Voldemort Nosql
Reactive Software Systems
Everything You Were Taught About Java Is Wrong
Concurrent talk
Concurrency Constructs Overview
Dlsecyx pgroammr (Dyslexic Programmer - cool stuff for scaling)
Modern Java Concurrency (Devoxx Nov/2011)
Exploring Ruby on Rails and PostgreSQL
Indic threads pune12-typesafe stack software development on the jvm
The Year of JRuby - RubyC 2018
JRuby: The Hard Parts
Ad

More from Theo Hultberg (10)

PDF
AWS Cost Optimization
PDF
Cassandra for all the Things
PDF
Building a CQL driver
PDF
Chasing the elephant
PDF
Learning to build distributed systems the hard way
PDF
Learning to build distributed systems the hard way
PDF
Learning to Build Distributed Systems the Hard Way
PDF
A Guide to the Post Relational Revolution
PDF
Shortcuts around the mistakes I've made scaling MongoDB
PDF
Standing on the shoulders of giants with JRuby
AWS Cost Optimization
Cassandra for all the Things
Building a CQL driver
Chasing the elephant
Learning to build distributed systems the hard way
Learning to build distributed systems the hard way
Learning to Build Distributed Systems the Hard Way
A Guide to the Post Relational Revolution
Shortcuts around the mistakes I've made scaling MongoDB
Standing on the shoulders of giants with JRuby

Recently uploaded (20)

PDF
project resource management chapter-09.pdf
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PPTX
The various Industrial Revolutions .pptx
PDF
Getting Started with Data Integration: FME Form 101
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PPTX
Tartificialntelligence_presentation.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
Hindi spoken digit analysis for native and non-native speakers
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
STKI Israel Market Study 2025 version august
PDF
A comparative study of natural language inference in Swahili using monolingua...
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Zenith AI: Advanced Artificial Intelligence
project resource management chapter-09.pdf
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Chapter 5: Probability Theory and Statistics
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
The various Industrial Revolutions .pptx
Getting Started with Data Integration: FME Form 101
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
Tartificialntelligence_presentation.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
1 - Historical Antecedents, Social Consideration.pdf
NewMind AI Weekly Chronicles – August ’25 Week III
Hindi spoken digit analysis for native and non-native speakers
cloud_computing_Infrastucture_as_cloud_p
STKI Israel Market Study 2025 version august
A comparative study of natural language inference in Swahili using monolingua...
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Programs and apps: productivity, graphics, security and other tools
Zenith AI: Advanced Artificial Intelligence

Concurrency and Distributed Systems Using JRuby