Re: Large number of short lived connections - could a connection pool help?

From: Ben Chobot <bench(at)silentmedia(dot)com>
To: Cody Caughlan <toolbag(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Large number of short lived connections - could a connection pool help?
Date: 2011-11-15 00:59:06
Message-ID: 8B054976-94B8-4971-B998-092D9C5CEB60@silentmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Nov 14, 2011, at 4:42 PM, Cody Caughlan wrote:

> We have anywhere from 60-80 background worker processes connecting to
> Postgres, performing a short task and then disconnecting. The lifetime
> of these tasks averages 1-3 seconds.

[snip]

> Is this something that I should look into or is it not much of an
> issue? Whats the best way to determine if I could benefit from using a
> connection pool?

Yes, this is precisely a kind of situation a connection pooler will help with. Not only with the the connection set up/tear down overhead, but also by using resources on your server better.... you probably don't actually have 60-80 cores on your server, so reducing that number down to just a few that are actually working will the Postgres finish them faster to work on others. Basically, the queueing happens off the postgres server, letting postgres use the box with less interruptions.

Now, is it a problem to not use a pooler? That depends on if it's causing you grief or not. But if you think you'll get more connection churn or larger numbers of workers, then a connection pooler will only help more.

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Cody Caughlan 2011-11-15 01:04:20 Re: Large number of short lived connections - could a connection pool help?
Previous Message Cody Caughlan 2011-11-15 00:42:00 Large number of short lived connections - could a connection pool help?