Re: max_connections limit

From: Sean Chittenden <sean(at)chittenden(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Babak Badaei <babak(at)hemaka(dot)com>, pgsql-admin(at)postgresql(dot)org
Subject: Re: max_connections limit
Date: 2003-04-18 22:09:42
Message-ID: 20030418220942.GK79923@perrin.int.nxad.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> > 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

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2003-04-19 00:40:23 Re: max_connections limit
Previous Message Tom Lane 2003-04-18 21:52:26 Re: max_connections limit