Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Concurrency and Distributed Systems in JRuby
Search
Theo Hultberg
August 17, 2012
Programming
3
620
Concurrency and Distributed Systems in JRuby
Presentation given av JRubyConf EU/Eurucamp 2012
Theo Hultberg
August 17, 2012
Tweet
Share
More Decks by Theo Hultberg
See All by Theo Hultberg
Datalakes at AWS Summit Stockholm 2018
iconara
0
73
Building a CQL driver
iconara
0
49
Chasing the Elephant
iconara
0
76
Learning to Build Distributed Systems the Hard Way
iconara
1
140
Learning to Build Distributed Systems the Hard Way
iconara
2
200
Learning to Build Distributed Systems the Hard Way
iconara
3
5.1k
A Guide to the Post Relational Revolution
iconara
4
5.4k
Standing on the Shoulders of Giants with JRuby
iconara
4
150
Shortcuts Around the Mistakes I've Made Scaling MongoDB
iconara
4
160
Other Decks in Programming
See All in Programming
Timeline エディター拡張入門
yucchiy
0
460
Good first issues of TypeProf
mame
4
1.1k
otelcol receiver 自作RTA / Pepabo Tech Conference #22 春のSREまつり
arthur1
0
1.1k
Docker_OSS_ホスティング入門
satokoki645
0
140
GitHub Actionsの痒いところを埋めるサードパーティーランナー
dora1998
2
290
The grand strategy of Ruby Parser
yui_knk
5
520
Porting mruby/c for the SNES (Super Famicom) - RubyKaigi 2024
gedorinku
0
1k
RuboCop: LSP and Prism
koic
2
140
slog登場に伴うloggerの取り回し手法の見直し / kamakura.go #6
arthur1
0
180
ts-morphを使ってコードリプレイスとASTへのハードルを下げる!
nyawach
5
340
WebGLで始める コンピュータグラフィックス入門
heller77
0
400
Let's use LLMs from Ruby 〜 Refine RBS types using LLM 〜
kokuyouwind
0
190
Featured
See All Featured
The Invisible Side of Design
smashingmag
294
49k
Designing with Data
zakiwarfel
96
4.8k
Practical Orchestrator
shlominoach
183
9.8k
A better future with KSS
kneath
231
16k
Optimising Largest Contentful Paint
csswizardry
13
2.4k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
15
1.6k
The Cost Of JavaScript in 2023
addyosmani
21
4k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
41
4.5k
Adopting Sorbet at Scale
ufuk
69
8.6k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
14
8.4k
Reflections from 52 weeks, 52 projects
jeffersonlam
345
19k
A Philosophy of Restraint
colly
197
16k
Transcript
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
enough rope THREADS
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
STATE AGGREGATION INPUT PERSISTENCE OUTPUT TIMER
STATE AGGREGATION INPUT PERSISTENCE OUTPUT TIMER !
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
CASSANDRA very verbose drivers 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 }
EURYDICE JRuby nails it new_data = {:domain => 'www.datastax.com', :time
=> Time.now.to_i} column_family.update('a key', new_data)
STORM stream processing framework written in Clojure
STORM (it does the arrows, you do the blobs)
REDSTORM Storm for JRuby
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 YOUR CODE
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