Parallel and Thread-Safe Ruby at High-Speed with TruffleRuby

Parallel and Thread-Safe Ruby at High-Speed with TruffleRuby

These are the slides of my keynote at RubyKaigi 2018: http://rubykaigi.org/2018/presentations/eregontp.html#jun02

Array and Hash are used in every Ruby program. Yet, current implementations either prevent the use of them in parallel (the global interpreter lock in MRI) or lack thread-safety guarantees (JRuby and Rubinius raise an exception on concurrent Array append). Concurrent::Array from concurrent-ruby is thread-safe but prevents parallel access.

This talk shows a technique to make Array and Hash thread-safe while enabling parallel access, with no penalty on single-threaded performance. In short, we keep the most important thread-safety guarantees of the global lock while allowing Ruby to scale up to tens of cores!

0ea7f61aec8fee539be0cf39b7bab77c?s=128

Benoit Daloze

June 02, 2018
Tweet