[Mongrel] multi threaded theoretically useful?

Kirk Haines wyhaines at gmail.com
Fri Oct 5 12:55:37 EDT 2007

On 10/5/07, Roger Pack <rogerpack2005 at gmail.com> wrote:
> Thanks to all for your helpful answers on this question.  It's nice to
> belong to a mailing list that has smart users (not that others don't,
> of course).
> So overall the answer to my question is that a multi-threaded rails
> app might well not be significantly faster because say it has 10
> threads, if 1 thread is waiting on a long-taking DB query, the other 9
> are blocked anyway, so the benefits of a multi-threaded model are moot
> (so a single-threaded rails is perhaps about as fast as a
> multi-threaded rails).  Bring on Ruby 2.0 :)

Multi-threaded may even be slower, in fact.  :)  In a lot of the
cases, it will definitely be slower.

Even on a platform with native threads, multithreading may be no
faster than a multiprocess model.  It's not a magic bullet.

> Further question:
> would providing the option of having mongrel bind to UNIX sockets
> perhaps speed it? (i.e. bind to port 3000 and unix socket x).  Just a
> thought.  Probably not enough speed difference to matter, but perhaps
> useful for local processes and simple to implement. Thoughts?

I used to run all of my IOWA apps via unix sockets.  I don't do that
anymore, though.  There are situations where it can arguably be
useful, but most of the time it just doesn't matter.  Any differences
between and /path/to/a/unix/socket are lost in the
noise of the rest of the performance affecting load -- they are just
too small to matter much.

Kirk Haines

More information about the Mongrel-users mailing list