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
86
Building a CQL driver
iconara
0
50
Chasing the Elephant
iconara
0
83
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
どうして手を動かすよりもチーム内のコードレビューを優先するべきなのか
okashoi
3
690
Kaigi on Railsに初参加したら、その日にLT登壇が決定した件について
tama50505
0
120
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
1.1k
Запуск 1С:УХ в крупном энтерпрайзе: мечта и реальность ПМа
lamodatech
0
770
선언형 UI에서의 상태관리
l2hyunwoo
0
230
Fibonacci Function Gallery - Part 2
philipschwarz
PRO
0
150
Androidアプリのモジュール分割における:x:commonを考える
okuzawats
1
240
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
980
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
280
開発者とQAの越境で自動テストが増える開発プロセスを実現する
92thunder
1
210
return文におけるstd::moveについて
onihusube
1
1.3k
MCP with Cloudflare Workers
yusukebe
2
230
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
230
52k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Docker and Python
trallard
43
3.2k
A Philosophy of Restraint
colly
203
16k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
3
190
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Java REST API Framework Comparison - PWX 2021
mraible
28
8.3k
Into the Great Unknown - MozCon
thekraken
34
1.5k
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