Re: SHMMAX and shared_bufffers

From: "Thom Brown" <thombrown(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: SHMMAX and shared_bufffers
Date: 2008-11-12 10:58:01
Message-ID: bddc86150811120258p572cdeadw3c2adddd4beca54d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks guys.

I think I've got a clearer idea of what's going on here. Basically I
need to take more into account than just the shared buffers setting,
and knowing that, I can leave extra head-room for other options which
will likely take up shared memory.

Cheers

Thom

On Wed, Nov 12, 2008 at 1:18 AM, Greg Smith <gsmith(at)gregsmith(dot)com> wrote:
> On Tue, 11 Nov 2008, Thom Brown wrote:
>
>> I've noticed that if I set my SHMMAX to 256 * 1024 * 1024 (268435456)
>> and my shared_buffers value in postgresql.conf to 256MB the server
>> fails to start. I managed to find a tipping point: 249MB seems to be
>> too much and 248MB seems to be okay.
>
> Buffers are allocated in 8K blocks. When you use '256MB', that turns into
> 32768 of those. Each buffer has a header and some other overhead such that
> they actually take up 8400 bytes[1], which totals 1.025X the amount that
> actually goes into the buffer pool. There's another MB or two that goes
> into other overhead, that part depends on things like max_connections. That
> overhead computation isn't even exact in the source code![2]
>
> At shared_buffers=248MB, just the buffer pool overhead pushes the required
> amount to allocate up to 254.3MB; that just slips by with the rest of your
> settings. At 249MB, the buffer pool needs 255.3MB. With the other overhead
> added in, that just exceeds the 256MB SHMMAX and fails.
>
> 1:
> http://www.postgresql.org/docs/current/static/kernel-resources.html#SHARED-MEMORY-PARAMETERS
> 2:
> http://doxygen.postgresql.org/ipci_8c.html#5371eff96f6dea948021ddfc9f0f5a38
>
> --
> * Greg Smith gsmith(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message zxo102 ouyang 2008-11-12 10:59:24 how to "group" several records with same timestamp into one line?
Previous Message zxo102 ouyang 2008-11-12 10:57:42 how to several records with same timestamp into one line?