Ruby's Scheduler: Improving I/O
summary
Ruby's main-reactor scheduler uses a simple round-robin with a 100 ms quantum, which yields high throughput but poor responsiveness: threads that block on I/O get requeued at the tail and can wait hundreds of milliseconds behind long-running threads. Proposed fixes include dynamic priorities, a multi-level feedback queue that promotes I/O-bound threads and demotes CPU-bound ones, or MN (green) threading to allow a much smaller quantum. No production change exists yet and results are unvalidated because Ruby bench thread benchmarks are still sparse.
AI-written summary · about
chapters (11)
- 0:00Introduction and background
- 2:57Problem with current scheduler
- 6:26Ideal scheduler behavior
- 8:10Priority in Ruby threads
- 9:12Fiber scheduler limitations
- 10:16Go’s scheduler solution
- 12:22Python’s GIL drop approach
- 13:48Potential Ruby solutions
- 17:27Multi-level feedback queue
- 18:49Lack of scheduler benchmarks
- 20:33Call to action and summary
related talks
28mConcurrency for Rubyists
27mIn-Depth Ruby Concurrency: Navigating the Ruby concurrency landscape
33mConcurrency for !Dummies (Who Don't Get It (...Yet))
23mParallel Processing With Ruby
38mScaling Ruby with Actors, or How I Learned to Stop Worrying and Love Threads
33mDear God What Am I Doing? Concurrency and Parallel Processing
36mModern Concurrency Practices in Ruby
47mBetter Ruby
