Re: max_connections limit - Mailing list pgsql-admin

From Sean Chittenden
Subject Re: max_connections limit
Date
Msg-id 20030418220942.GK79923@perrin.int.nxad.com
Whole thread Raw
In response to Re: max_connections limit  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: max_connections limit
List 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


pgsql-admin by date:

Previous
From: Tom Lane
Date:
Subject: Re: max_connections limit
Next
From: Tom Lane
Date:
Subject: Re: max_connections limit