Making Hash Parallel, Thread-Safe and Fast!
summary
Implements a new concurrent hash storage in TruffleRuby that switches storage when an object becomes shared, uses lock-free per-bucket lists and a lock-free doubly linked list to preserve insertion order, and gates heavy structure changes with a layout lock (and a lighter variant). On a 65k-key workload with 80% reads 10% writes 10% deletes it scales to 44 threads (~20–22× speedup vs single thread), and single-thread overhead is essentially zero.
AI-written summary · about
chapters (10)
- 0:00Introduction and motivation
- 1:29Challenge and TruffleRuby context
- 9:07Why make hash thread-safe
- 13:19Hash storage strategies
- 16:28Concurrent hash storage design
- 17:53Layout lock for synchronization
- 20:00Performance and scalability results
- 21:43Single-threaded overhead comparison
- 22:27Benefits and ecosystem impact
- 23:30How to try and contribute
related talks
23mParallelization of Dynamic Languages - Synchronizing Built-in Collections
38m"Parallel and Thread-Safe Ruby at High-Speed with TruffleRuby"
43mParallel and Thread-Safe Ruby at High-Speed with TruffleRuby
42mLook out! Gotchas of Using Threads in Ruby
19mThread Safety First!
31mBig O in a Homemade Hash
11mWhy Hashes Will Be Faster in Ruby 2.0
23mLock-free Concurrent Level Hashing for Persistent Memory
