A deep-dive into Ruby's four concurrency primitives — processes, threads, fibers, and Ractors — explaining how each works, when to use them, and what actually happens at runtime. Covers the GVL's impact on parallelism vs. I/O concurrency, how fibers cooperatively yield at I/O boundaries without async/await syntax, database connection behavior during fiber scheduling, transaction safety, and the cost of spawning too many fibers. Compares Ruby's colorless fiber model to Python's async/await and Go's goroutines, and provides a practical decision guide for matching concurrency primitives to workload types (I/O-bound vs. CPU-bound).

17m read timeFrom paolino.me
Post cover image
Table of contents
The four primitivesHow scheduling worksThe GVL: why threads and fibers are more similar than you thinkWhat happens when a fiber hits I/OWhat happens when a fiber does CPU-bound workWhat happens when a fiber queries the databaseWhat happens when a fiber starts a transactionWhat happens when you have too many fibers“Why not just configure more Solid Queue threads?”“Why not Ractors?”“Isn’t this just what JavaScript does?”“Isn’t this just what Go does?”“Fibers need Async do blocks. That’s still new syntax.”When to use what

Sort: