I currently am part of a team writing an app and I’m running into an
issue with connection pools.
Quick infrastructure overview: Rails 2.2.2, Ruby 1.8.7p72, Apache/
Mongrel, mongrel running single threaded. Due to legacy schema, the
mongrels are making connections to a couple of different DB.
We currently are running about 28 mongrels, and obviously with a
default 5 connections/per mongrel, we’re getting 140 connections to
the db. This seems kind of wasteful, especially as we scale larger.
So the first thing I tried is setting the pool size to 1. I figured
since only one request is being processed at a time, there’s only a
need for one db connection. However, this cause the app to start
spewing ‘could not obtain db connection’ errors.
So I bumped the pool size up to 2, and things seem to be OK, however
when I go into mysql and show processlist, it looks like there are 4
or 5 connections open.
Basically, I realize that there the connection pool is necessary to
support multithreading, but is there any way to pare things down to
one connection per mongrel like the old day, when we aren’t using the