Search Postgresql Archives

Re: SHMMAX and shared_bufffers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxx http://www.gregsmith.com Baltimore, MD
>

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux