Re: Why would I want to use connection pooling middleware?

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: Kirk Strauser <kirk(at)strauser(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why would I want to use connection pooling middleware?
Date: 2009-01-15 20:54:22
Message-ID: 496FA27E.9050009@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Kirk Strauser wrote:
> On Jan 15, 2009, at 12:30 PM, Steve Crawford wrote:
>
>> But if your application is designed to work well with pooling, it can
>> provide dramatic performance benefits.
>
> I think that's the problem. As I mentioned at one point, a lot of our
> applications have connections open for hours at a time and fire off
> queries when the user does something. I'm coming to think that
> pooling wouldn't give much benefit to long-living processes like that.
>

If you know that the application does not change GUC variables then you
will probably benefit greatly by using pgbouncer. If all the queries are
single-statements then set pool_mode=statement. If you have
multiple-statement transactions then configure pgbouncer to use
pool_mode=transaction. Either way, your app won't tie up a back-end
connection when it is sitting idle. You will probably find that you can
handle your hundreds of clients with a pretty small pool of backend
connections. Pgbouncer will give you some nice statistics to help you
adjust the pool sizing and such.

> On a related note, is max_connections=400 reasonably sized for a
> server with 8GB of RAM? Again, most of these are dormant at any given
> time. The database itself is currently hosted on a dual Xeon server
> with 3GB of RAM and other applications so I'm sure the new 8-core/8GB
> hardware is bound to do better at any rate.

Too little info (and others here can answer better anyway). But I think
you should test pooling and find out how many you really need before
jumping into tuning. I haven't tried Pgpool* but have found pgbouncer to
be easy-to-use, reliable and effective.

Cheers,
Steve

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jason Long 2009-01-15 20:56:01 Re: HTML email (was Re: Vacuum and Reindex hangs
Previous Message Raymond O'Donnell 2009-01-15 20:49:29 Re: Vacuum and Reindex hangs