Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a Rails application with 4 Unicorn workers. How do I determine what postgresql database pool size I should use?

And if I have 6 applications connecting to this postgres database, would that be too many connections? And should I use pgbouncer instead? If so, why?

share|improve this question
    
This seems to be a repost of dba.stackexchange.com/questions/23536/… . What's changed? I strongly suggest rephrasing one or deleting one. –  Craig Ringer Sep 1 '12 at 10:13
    
Done. I had originally posted to SO. They suggested I ask on here instead, which I did. A few hours later they closed my original question and moved it to dba.SE. –  Ron Garrity Sep 1 '12 at 13:43
    
Yeah, that happens. Sorry, I know it's annoying, and I wish I could stop that happening. –  Craig Ringer Sep 1 '12 at 13:51
    
What's the the max connections possible if all your users logged into all the apps they are able to log into? That at least gives you a high water mark to consider how many pool connections you have to deal with. –  Bob Oct 9 '12 at 14:33
add comment

1 Answer 1

There really isn't enough to go on here. 10 concurrent connections isn't a lot for most setups.

The best advice I can give is start simple and when you start to run into cases where performance is starting to become an issue then look at more complex solutions unless you know it will be an issue (say 1000 concurrent users and millions of queries from the web every day). Otherwise you build in complexity you may never need. However, by all means monitor and keep an eye out for scaling out solutions that work for you (I recommend keeping an eye on Slony and Postgres-XC in this regard in addition to other solutions). They are at the upper end of complexity but if you need something that can do anything you need it to, they are the solutions.

As it is though, generally for the number of concurrent connections you are talking about, there is no need to consider something complicated until you start to need it. Then you will have a better idea of what you need in a solution.

Premature optimization is the root of all evil.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.