[Mongrel-development] Unicorn - Gossamer Fork: With Threads

Eric Wong normalperson at yhbt.net
Sun Apr 26 16:38:35 EDT 2009

Hi all,

I've pushed out a new branch of Unicorn named "gossamer" to my git repo
that uses threads.  It's mainly to ease integration of Unicorn code into
Mongrel, but may even be useful to someone today.  Like Unicorn, it only
runs on Unix-like systems.

I'm not planning on making any release packages for this myself.

Here's a snippet of the README:

-------------------------- 8< -------------------------
== Unicorn for the masochists that use threads

* An experimental fork of Unicorn for deployments where using threads
may make some sense: 3rd-party API calls, long-polling, Comet...

* This is primarily intended as a staging area for reintegrating
Unicorn code into Mongrel.

* Both processes and threads are used, each process spawns a
predetermined number of worker threads.  The total number of
concurrent clients is worker_processes * worker_threads.

=== Differences from Unicorn

* Log rotation happens immediately instead of being deferred to
happening in-between requests.  This means multiline log messages
can be split between log rotations.

* Threads are used.  Meaning all the headaches (and rare benefits)
of using them will be exposed to your application code.

=== Differences from Mongrel

* Worker threads are pre-spawned instead of being spawned for
every request.  This makes memory usage more predictable and should
theoretically perform better with native threads under Ruby 1.9.  Each
worker thread does non-blocking accept on shared sockets.

* Everything else that's different from Mongrel in Unicorn...
-------------------------- 8< -------------------------

Eric Wong

More information about the Mongrel-development mailing list