Spinning Multiple Plates: Concurrency in Rails
summary
Live demonstration uses four volunteers racing over a shared pile of G Play bricks to illustrate race conditions and resource contention; the slow-vs-fast request demo inserts a 3s sleep and shows distinct thread IDs and overlapping timestamps. Rails is thread-safe since 2.2 (2008), Puma serves requests on threads, and features like Active Job, Action Cable, asynchronous ActiveRecord (load_async), the load interlock and permit_concurrent_loads plus the executor/reloader and current attributes handle setup, cleanup and thread-local state.
AI-written summary · about
chapters (14)
- 0:00Introduction and welcome
- 1:24G Play bricks demo setup
- 6:48About the speaker and topic
- 8:53Concurrency vs parallelism
- 10:39Race conditions and resource contention
- 12:26Why concurrency matters
- 13:08Threads and memory sharing
- 14:54Fibers vs threads
- 15:59Concurrency in Rails
- 17:23Puma threaded server demo
- 19:50Action Cable and async queries
- 21:37Rails source code deep dive
- 24:22Current attributes explained
- 26:27Key takeaways and closing
