X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0DF1740C1B0 for ; Sun, 30 Jan 2005 21:28:13 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 12951-03 for ; Sun, 30 Jan 2005 21:27:57 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.194]) by svr1.postgresql.org (Postfix) with ESMTP id 9EB9E40C19F for ; Sun, 30 Jan 2005 21:26:27 +0000 (GMT) Received: by wproxy.gmail.com with SMTP id 67so493284wri for ; Sun, 30 Jan 2005 13:26:29 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=tKNI065w/KyYnNbhAxSNM4BmQAmiLF6ZNOPugwdMWO+ryoa100abtCEr+PXu9mrsiDxAtVEINHzBzTAslO+IA0eoDLwipDwHoVWuPAAIJfawriRYl6Ym612a8dXQKE1SW4fayyUXzQSmJZ8Zep9ZyfAL1AkkKekd5gAdqHxdx6g= Received: by 10.54.46.67 with SMTP id t67mr212335wrt; Sun, 30 Jan 2005 13:26:29 -0800 (PST) Received: by 10.54.48.2 with HTTP; Sun, 30 Jan 2005 13:26:29 -0800 (PST) Message-ID: <9776bb660501301326565859a3@mail.gmail.com> Date: Sun, 30 Jan 2005 16:26:29 -0500 From: Rick Apichairuk Reply-To: Rick Apichairuk To: pgsql-general@postgresql.org Subject: Re: FreeBSD 5.2.1, postgresql 7.4.5 and shared memory settings In-Reply-To: <20050130205021.GA14588@guests.deus.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <9776bb66050130122122a3e342@mail.gmail.com> <20050130205021.GA14588@guests.deus.net> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.024 tagged_above=0 required=5 tests=AWL, RCVD_BY_IP X-Spam-Level: X-Archive-Number: 200501/1762 X-Sequence-Number: 72711 On Sun, 30 Jan 2005 20:50:21 +0000, Richard Poole wrote: > On Sun, Jan 30, 2005 at 03:21:25PM -0500, Rick Apichairuk wrote: > > > I am trying to increase the number of max_connections to 200 and found > > out I couldn't even start postgresql. So I tried to increase > > max_connections gradually (currently at 50 from 40 default) and adjust > > shared memory settings along the way. Even at 50 max_connections, I > > still cannot get postgresql to start. > > > > The following is the error message I receive: > > > > pgsql FATAL: could not create shared memory segment: Invalid argument > > DETAIL: Failed system call was shmget(key=5432001, size=35323904, > > 03600). > > > To reduce the request size (currently 35323904 bytes), > > > kern.ipc.shmmax: 33554432 > > Looks like the request size is just higher than shmmax. The majority of > the request is for the shared buffers, so if you can't increase shmmax > any more you can reduce your shared buffers downwards from 4096 and this > will give you some room for more connections. > > > Richard > Thanks... I missed that completely (need sleep!). I will try to bump up my SHMMAXPGS from 262144 to 400000. Is the shared_buffers per process? The reason I ask is the formula given on http://www.postgresql.org/docs/7.4/static/kernel-resources.html for calculating how much SHMMAX you need is: SHMMAX = 250 kB + 8.2 kB * shared_buffers + 14.2 kB * max_connections up to infinity If it were per process (connection) shouldn't it be: SHMMAX = (250 kB + 8.2 kB * shared_buffers + 14.2 kB) * max_connections up to infinity Also the examples for FreeBSD are: options SYSVSHM options SHMMAXPGS=4096 options SHMSEG=256 options SYSVSEM options SEMMNI=256 options SEMMNS=512 options SEMMNU=256 options SEMMAP=256 How many connections is this supposed to support? Thanks in advance.