(2009-10-15) Unix Preforking Servers

Ryan Tomayko demonstrates Pre-Forking code leveraging the UNIX-native opportunities. Eric Wong's mostly pure-RubY HTTP backend (Web Server), 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 (MultiProcess). And all the tricks and idioms required to use them reliably... MRI Ruby people need to accept, like Python (you have seen multiprocessing, yes?), that Unix processes are one of two techniques for achieving reliable ConCurrency and parallelism in server applications. Threads (Multi Threaded) are out. You can use processes, or ASynch/events, or both processes and async/events, but definitely not threads. Threads are out.

Jacob Kaplan Moss replicated the code in Python. Then he curated a bunch of related links, included other Python versions.

Update: GUnicorn 'Green Unicorn' is a Python WSGI HTTP Server for UNIX. It's a pre-fork worker model ported from Ruby's Unicorn project. The Gunicorn server is broadly compatible with various web frameworks, simply implemented, light on server resources, and fairly speedy... Natively supports WSGI, Django, and Paster.


Edited:    |       |    Search Twitter for discussion