From: Sean Chittenden <sean@chittenden.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Babak Badaei <babak@hemaka.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: max_connections limit
Date: Fri, 18 Apr 2003 15:09:42 -0700
Message-ID: <20030418220942.GK79923@perrin.int.nxad.com> (raw)
In-Reply-To: <14484.1050702746@sss.pgh.pa.us>
References: <20030317232640.GV23355@perrin.int.nxad.com>
<000d01c30559$f9e41b10$6401a8c0@DDP7NX01>
<20030418201826.GD79923@perrin.int.nxad.com>
<14484.1050702746@sss.pgh.pa.us>
> > I wonder how correct the following is:
>
> > SHMMAXPGS = ((max_connections * shared_buffers * 16K) + (wal_buffers *
> > 8K) + (max_fsm_relations * 40B) + (max_fsm_pages * 6B)) /
> > page_size
>
> Not very. shared_buffers are 8K apiece, not 16K, and you don't multiply
> them by max_connections. There *is* a multiplier for max_connections
> but I'm not sure what it is --- less than 1K, probably.
Alright, the output wasn't quite right in terms of matching up with
real world data so this doens't surprise me....
I know they're 8K, but going off of the hint from postgresql.conf, I
changed it to 16K instead of 2 * 8K:
#shared_buffers = 64 # 2*max_connections, min 16, typically 8KB each
Each shared buffer is 8K, need two shared buffers per connection is
how I read that comment.
> Also you should allow for the lock table, which will be some small
> multiplier times max_connections * max_locks_per_transaction.
I don't know what data structure is used for the locking... I'm
guessing it's not a pthread's mutex. :) sizeof(void *) or some
struct?
> > SEMMNI = 2 * max_connections (????)
> > SEMMSL = SEMMNI
> > SHMSEG = 10 # (???? this is a per SysV process setting)
> > SEMMNS = 1.5 * max_connections (????)
> > SEMMNU = 0.75 * max_connections (????)
> > SEMUME = 10 (????)
>
> Dunno where you got these semaphore numbers from, either.
Eh, a cross between the approximations in post-install-notes from
FreeBSD and the databases that I manage. I suspect someone will have
to audit the code to come up with an official recommendation.
--
Sean Chittenden
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: sean@chittenden.org, tgl@sss.pgh.pa.us, babak@hemaka.com
Subject: Re: max_connections limit
In-Reply-To: <20030418220942.GK79923@perrin.int.nxad.com>
References: <20030317232640.GV23355@perrin.int.nxad.com> <000d01c30559$f9e41b10$6401a8c0@DDP7NX01> <20030418201826.GD79923@perrin.int.nxad.com> <14484.1050702746@sss.pgh.pa.us> <20030418220942.GK79923@perrin.int.nxad.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox