X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A8A1847636C for ; Fri, 18 Apr 2003 18:09:41 -0400 (EDT) Received: from perrin.int.nxad.com (internal.ext.nxad.com [69.1.70.251]) by postgresql.org (Postfix) with ESMTP id 14584475EF0 for ; Fri, 18 Apr 2003 18:09:41 -0400 (EDT) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id 963F421084; Fri, 18 Apr 2003 15:09:42 -0700 (PDT) Date: Fri, 18 Apr 2003 15:09:42 -0700 From: Sean Chittenden To: Tom Lane Cc: Babak Badaei , pgsql-admin@postgresql.org Subject: Re: max_connections limit Message-ID: <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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <14484.1050702746@sss.pgh.pa.us> User-Agent: Mutt/1.4i X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 X-Web-Homepage: http://sean.chittenden.org/ X-Spam-Status: No, hits=-32.9 required=5.0 tests=BAYES_01,IN_REP_TO,QUOTED_EMAIL_TEXT,QUOTE_TWICE_1, REFERENCES,REPLY_WITH_QUOTES,USER_AGENT_MUTT autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/267 X-Sequence-Number: 8422 > > 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