Eric Wong’s mostly pure-Ruby HTTP backend, Unicorn, is an inspiration. I’ve studied this file for a couple of days now and it’s undoubtedly one of the best, most densely packed examples of Unix programming in Ruby I’ve come across.
Unicorn is basically Mongrel (including the fast Ragel/C HTTP parser), minus the threads, and with teh Unix turned up to 11. That means processes. And all the tricks and idioms required to use them reliably.
We’re going to get into how Unicorn uses the OS kernel to balance
connections between backend processes using a shared socket,
fork(2), and accept(2) — the basic Unix prefork model in
100% pure Ruby.
But first …
GitHub documents the how and why behind their Unicorn setup. Also, for the record, the fork(2) + shared accept socket technique described in my Unicorn is Unix piece was first explained to me by Chris and Tom.
Jacob Kaplan-Moss does the prefork echo server example from my Unicorn is Unix piece in Python. Awesome. Let’s see some more of these. Where you at, Perl?
Chuck presents the results of a few ab runs against Thin and Unicorn. Surprising, even if the benchmarks lack rigor. I’d like to see good autobench runs for all of the backends on same hardware/network.