From owner-freebsd-performance@FreeBSD.ORG Thu Aug 4 17:45:08 2005 Return-Path: X-Original-To: freebsd-performance@freebsd.org Delivered-To: freebsd-performance@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D4DF416A41F for ; Thu, 4 Aug 2005 17:45:08 +0000 (GMT) (envelope-from sean@noc-phone.gigave.com) Received: from mailhost.gigave.com (mailhost.gigave.com [38.113.228.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id B37DF43D49 for ; Thu, 4 Aug 2005 17:45:08 +0000 (GMT) (envelope-from sean@noc-phone.gigave.com) Date: Thu, 4 Aug 2005 10:45:08 -0700 From: Sean Chittenden To: Claus Guttesen Message-ID: <20050804174508.GA70123@sean.gigave.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Cc: freebsd-performance@freebsd.org Subject: Re: changing max_connections in postgresql on FreeBSD 5.4 X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2005 17:45:09 -0000 > I recently lowered max_connections from 1024 to 384 in > /usr/local/pgsql/data/postgresql.conf. The server is a quad opteron @ > 2 GHz and 4 GB of RAM. > > This decreased the SIZE and RES values in top and it seems that the > current max_connections is more than adequate. To see how many > concurrent connections the db-server had I did a 'netstat -na|grep > -i establi|wc -l' which showed some 230 established connections > during peak. > > In order to use max_connections set to 1024 I had to raise the > following values in the kernel: > > options SHMMAXPGS=327680 > options SEMMNI=200 > options SEMMNS=1200 > options SEMUME=200 > options SEMMNU=600 > > The values were taken from the postgresql-ports-installation-notes > and were simply increased to fit the max_connections-parameter in > postgresql.conf. > > Will more RAM become available to postgresql if I change the > kernel-values mentioned above to half the size? Yes, it will raise the in-kernel limits so that PostgreSQL can allocate more RAM for its user-land cache. You will probably have a better ROI in terms of performance by increasing the kernel's caching parameters as opposed to PostgreSQL's cache. You need both, don't get me wrong, but there is lots of performance to be gained by increasing the amount of caching the kernel does. -sc -- Sean Chittenden