On 02/25/2012 08:13 AM, Scott Ribe wrote:

What I'm trying to determine is: should I plan on using pgbouncer?

With Rails&  Passenger, do the app server processes take and hold connections to 
the db? Or take&  release with queries/connections?

This is not a scalability question; given the traffic the site will have I only 
need a small handful of connections. It's a latency question, I don't want to 
be starting up new pg processes excessively.

(Yes, I thought about asking on the RoR list, since it's really a question about 
RoR behaviors, but on the other hand it involves pg optimization&  best 
practice, which is, ahem, different than with MySQL.)


Alright I did a quick google and passenger appears to be essentially mod_rails, which means you are going to generate a connection for every httpd process you have (unless something has changed that I don't know about).

So on the one hand it is good because your connections will be persistent, on another hand it is bad because you will open connections even if you aren't using the database. That said, it is a rails app so it is likely you are using the database no matter what.

Where pgbouncer might come in handy here, is that it can open more connections than you have httpd processes, and thus you will reduce the fork cost of the new process just because someone hits the website.

JD

--
Command Prompt, Inc. - http://www.commandprompt.com/
PostgreSQL Support, Training, Professional Services and Development
The PostgreSQL Conference - http://www.postgresqlconference.org/
@cmdpromptinc - @postgresconf - 509-416-6579

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to