[Mongrel] Threading & database connections.

Luis Lavena luislavena at gmail.com
Tue Feb 28 11:52:57 EST 2006

Maybe Zed could answer this better, but will to a shot ;-)

Comments bellow...

On 2/28/06, Jeff Jones <jjones at raindrop.co.uk> wrote:
> Hello all.
> Bear with me, there is a Mongrel question in here ;)
> [snip]
> Having messed around (Read: failed)  with Apache getting Mongrel running was
> so simple (Thanks!). Then after a bit of testing I got shouted at by the
> Service department for a steadily increasing number of connections to the
> Oracle server.
> Having read up on Mongrel I see there is an option to limit the number of
> threads it can use. My question is: Does each thread correspond to a
> "Running" instance of the application? If so then limiting that would
> theoretically limit the number of DB connections...right? When I look at the
> task manager (Yet, I am running windows...no I didn't have a choice in the
> matter ;) I see only once instance of ruby.exe running.
The Threads that mongrel uses are only for socket connections. These
"workers" only perform the socket handshake and leave the reply stuff
to the CGI Wrapper (which in this case is rails).

If you check the code in mongrel_rails, you will see that because
rails isn't "thread-safe", a Mutex was used to avoid controllers from
executing simultaneously. The number of active connections shouldn't
be different from webrick.

I don't know if there is a way to dump information from active or
opened connections, maybe using script/console?

I guess don't have a lot of experience debugging code :-P


More information about the Mongrel-users mailing list