From: | "Tomas Vondra" <tv(at)fuzzy(dot)cz> |
---|---|
To: | "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
Cc: | "Jenish Vyas *EXTERN*" <jenishvyas(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Maximum number of client connection supported by Postgres 8.4.6 |
Date: | 2011-07-22 09:58:53 |
Message-ID: | 2bdc29f7869b5ee838b9e98b53733459.squirrel@sq.gransy.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 22 Červenec 2011, 10:29, Albe Laurenz wrote:
> Have you considered the possibility that the limit and the error do not
> originate in that database, but in the application server?
If the max_connections is 1200 and you get that error with 1000 of them,
it's probably a problem with a connection pool in your application server
(not such whit platform you're working on).
>> If possible guide me how to calculate max_connections based on
> available hardware.
>
> It is almost unlimited on any hardware. That does not mean that things
> will
> perform well beyond a certain limit. The limiting factor I mentioned is
> the
> operating system, and these limits can usually be adjusted.
Theoretically it's unlimited, in practice the optimal value is much lower.
The general rule of thmub is usually
max_connections = number of cores + number of drives
so with a 4-core CPU and 10 drives you'll get about 14 connections. That's
very rough - it might be a bit higher, but I don't expect to grow it above
30.
So having 1200 connections is a bit extreme - if the connections are
active all the time (not idle, doing something), the overhead of managing
them will be severe. Don't forget each connection is equal to a separate
process, so it's not exactly cheap.
Do you really need that number of connections?
What I'd suggest is to run a series of pgbench tests with various "-c"
values (10, 20, 30, ...) to get some basic starting point. Then I'd set
pgbouncer with this number of db connections and 1000 of client
connections, and pool_mode=transaction.
Tomas
From | Date | Subject | |
---|---|---|---|
Next Message | Achilleas Mantzios | 2011-07-22 10:25:21 | Re: Choosing primary key type: 64 or 52 bit primary keys? |
Previous Message | Thomas Pasch | 2011-07-22 09:21:26 | Re: Is there a way to 'unrestrict' drop view? |