Re: was there a change in FreeBSD SHM implementation from 4.4 to

From: Doug Silver <dsilver(at)urchin(dot)com>
To: Vivek Khera <khera(at)kcilink(dot)com>
Cc: stable(at)FreeBSD(dot)ORG, pgsql-general(at)postgresql(dot)org
Subject: Re: was there a change in FreeBSD SHM implementation from 4.4 to
Date: 2002-07-10 18:41:41
Message-ID: Pine.LNX.4.21.0207101138580.10594-100000@danzig.sd.quantified.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

For what it's worth, when I upgraded to 4.6, I came across this same
problem and I think asked the same question. Anyway, recompiling the
kernel with the following worked (note the "#PG" are specific numbers that
I put in for Postgres):

# Added for Postgres operation
options SHMMAXPGS=4096 #PG
options SHMSEG=256 #PG
options SYSVMSG #SYSV-style message queues
options SYSVSEM #SYSV-style semaphores
options SEMMNI=256 #PG
options SEMMNS=512 #PG
options SEMMNU=256 #PG
options SEMMAP=256 #PG

YMMV

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Doug Silver
Network Manager
Urchin Software Corp. http://www.urchin.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On Wed, 10 Jul 2002, Vivek Khera wrote:

> I have a dual cpu box with 2GB RAM dedicated to running Postgres.
> Last week, I upgraded FreeBSD from 4.4-STABLE to 4.6-RELEASE-p1. When
> I went to restart postgres, it complained that it could not allocate
> the shared memory segment. I'm running Postgres 7.2.1.
>
> For those familiar with postgres, I was using shared_buffers=100000
> with 4.4, but had to back that down to 32000 for 4.6. This is
> obviously impacting performance...
>
> The kern.ipc.* settings have not changed. In my /etc/sysctl.conf
> file, I set
>
> kern.ipc.shmmax=268435456
> kern.ipc.shmall=65535
> kern.ipc.shm_use_phys=1
>
> With FreeBSD 4.6, I even upped the shmmax to 1073741824 to no avail.
> I also set this in the kernel (so as to eliminate any issues with
> setting it at boot time).
>
> However, it does produce a most peculiar error message when running
> postgres:
>
> -- cut here --
> IpcMemoryCreate: shmget(key=5432001, size=665346048, 03600) failed: Cannot allocate memory
>
> This error usually means that PostgreSQL's request for a shared
> memory segment exceeded available memory or swap space.
> To reduce the request size (currently 665346048 bytes), reduce
> PostgreSQL's shared_buffers parameter (currently 80000) and/or
> its max_connections parameter (currently 48).
> -- cut here --
>
>
> Now, by my arithmetic, 665346048 is certainly less than 1073741824 by
> quite a bit.
>
> I did not recompile postgres after the FreeBSD upgrade.
>
> Has something changed from 4.4-STABLE that would cause such a failure?
>
> The funny thing is that it worked just fine with FBSD 4.4 and the
> lower setting of shmmax (even with 100000 shared_buffers), so
> something is making postgres try to allocate a larger hunk of memory.
> I just don't know what.
>
> Any advice would be appreciated.
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marc G. Fournier 2002-07-10 18:42:33 Re: I am being interviewed by OReilly
Previous Message Marc G. Fournier 2002-07-10 18:41:02 Re: I am being interviewed by OReilly