06 Oct 2009

I like Unicorn because it's Unix

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 …

tomayko.com   09:23

09 Oct 2009

Unicorn!

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.

github.com   06:54

03 Sep 2009

Unicorn's signal handling

Unicorn is a newish Rack-based HTTP server that’s kinda sorta like Mongrel but comes packed with some insane process management features. The main link is to the SIGNALS file, which documents the master/worker process model, supported signals, process replacement, failover, etc. See the README for a high level description of features.

This link brought to you by @defunkt, who explained Unicorn’s unique approach (repeatedly) over the course of a week.

unicorn.bogomips.org   08:17

06 Jul 2009

Backlogs and Request Time

Adam takes a look at how long requests and backlog interact. The sleep example runs concurrently under Mongrel but Thin and WEBrick will backlog.

adam.blog.heroku.com   11:48

22 Feb 2008

GitHub: mongrel_proctitle GemPlugin

I repackaged mongrel_proctitle as a GemPlugin so that all mongrels on use it automatically. This is the first chance I’ve had to play with GitHub, too. Lovin' it.

github.com   16:08

Process title support for Mongrel

Constantly updates the the process title ($0) with something like: “mongrel_rails [10010/2/358]: handling 127.0.0.1: HEAD /feed/calendar/global/91/6de4”. Let’s you monitor backends with ps and top.

purefiction.net   14:16

08 Jan 2007

What Mongrel Isn't (Or, Write Your Own Damn Web Server)

“All you have to do is change the internal processing, add 200 more methods to the HTTP parser, serve Bittorrent over Ethernet, and have it save Korean orphans while eating a Mango in the back seat of an El Camino driven by twenty midget clowns.”

mongrel.rubyforge.org   09:08