NeverBlock, trivial non-blocking IO
summary
NeverBlock is a Ruby library that runs ordinary blocking-looking code concurrently by combining fibers with EventMachine, so code stays linear but yields at IO. It requires asynchronous drivers (it ships adapters for MySQL plus and PostgreSQL, hooks into ActiveRecord, Net::HTTP and Thin). Benchmarks show 100 synchronous queries fall from ~10s to ~1s, the author creates ~200,000 fibers vs ~8,000 threads, and one app cuts Thin processes from 16 to 4 for ~75% memory savings.
AI-written summary · about
chapters (15)
- 0:00Introduction
- 1:16What is NeverBlock
- 2:40Synchronous execution example
- 4:02Thread-based concurrency
- 5:28Event-driven callbacks
- 10:22Simplifying concurrency
- 14:00Fibers core mechanism
- 18:38Two-way fiber comms
- 21:32Fibers vs threads efficiency
- 22:36Fiber-event machine combo
- 25:50NeverBlock for Rails
- 27:15Request processing visualized
- 29:45Production impact
- 31:07Features and future
- 32:29Q&A
related talks
23mAsync Ruby
39mAsynchronous and Non-Blocking IO with JRuby
28mEvented Ruby vs Node.js
20mSubprocesses, Threads and Fibers
23mConcurrency Showdown: Threads vs. Fibers
42mHow to write synchronization mechanisms for Fiber
26mConcurrency in Ruby: From fork() to Fiber
35mConcurrency in Ruby: Threads, Fibers and Ractors Demystified
