From: Kirk Haines Date: 2006-05-27T02:23:15+09:00 Subject: Re: Mongrel "loopback"l request On Friday 26 May 2006 10:55 am, Peter C. Verhage wrote: > Kirk Haines wrote: > > Mongrel is not single threaded, but the Rails handler is because Rails is > > not thread-safe. > > But doesn't this then mean Mongrel is only capable of handling one Rails > request at at time? I just checked btw, when I use webrick I'm facing > the same problem. Maybe I am splitting hairs here, but Mongrel itself can handle X numbers of requests at the same time. Rails can not. The Rails handler for Mongrel synchronizes requests to Rails. So yes, the net effect is that while multiple requests can be recevied by the Mongrel/Rails process simultaneously, they are handled in serial fashion, which results in a deadlock when one request initiates a subrequest to the same server. It is a Rails issue, though, not a Mongrel one, to be specfic, and one that, I would guess, doesn't come up too often since most people aren't making subrequests to the same server in their request handling. To work around it, you either need to have an architecture where you have multiple mongrel/rails backend processes that requests get distributed to, or someone needs to write something like an SCGI handler for mongrel to let a single mongrel webserver communicate with multiple Rails backends. Anyone have any other ideas? Kirk Haines