A deep dive into how Ruby's four concurrency primitives — threads, processes, fibers, and Ractors — map directly onto production web server designs. Pitchfork uses OS processes with a clever 'refork' trick to preserve copy-on-write memory sharing. Puma uses a thread pool that exploits GVL release on I/O to handle many in-flight requests cheaply. Falcon uses fibers and an event loop to handle thousands of mostly-idle long-lived connections. Ractors, the only primitive enabling true in-process parallelism, have no production web server because Rails apps are full of mutable shared state that violates Ractor isolation requirements, and the memory/CPU benefits don't justify a full-app rewrite when Pitchfork already solves the parallelism problem via forking.

13m read timeFrom blog.codeminer42.com
Post cover image
Table of contents
What a web server actually doesWhat "parallel" actually means in RubyPitchfork – fork the worldPuma – thread the worldFalcon – fiber the worldThree shapes, side by sideWhy Ractors aren’t on this list

Sort: