[Mongrel] multi threaded theoretically useful?

Kirk Haines wyhaines at gmail.com
Fri Sep 7 16:14:09 EDT 2007

On 9/7/07, Pete DeLaurentis <pete at nextengine.com> wrote:
> Here's one question that I think would have an impact on how useful
> green threads are for many server apps:
> If you are blocking on something like a database SELECT in one green
> thread, will the Ruby interpreter switch to another green thread
> while it's waiting for the response?
> Or does a blocking request block all green threads?

When the flow of execution leaves Ruby and goes into some 3rd party
extension (like that of a DB library), then ruby can't context switch.

So yes, when one does a DB query that is going through a C extension,
all of the other green threads are blocked, so that latency can't be

If it could be, then yes, there would be some benefit from some number
of green threads per process for typical web apps.

Kirk Haines

More information about the Mongrel-users mailing list