pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Kirkwood <markir@paradise.net.nz>
To: paul@paulmcgarry.com
Cc: Cosimo Streppone <cosimo@streppone.it>
Cc: Martin Fandel <martin.fandel@alphyra-evs.de>
Cc: Postgresql Performance list <pgsql-performance@postgresql.org>
Subject: Re: SHMMAX / SHMALL Was (Re: postgresql-8.0.1 performance
Date: Fri, 03 Jun 2005 18:11:54 +1200
Message-ID: <429FF4AA.7090200@paradise.net.nz> (raw)
In-Reply-To: <a056b1d405060220451b029a15@mail.gmail.com>
References: <1117201312.7060.6.camel@fandelm.ecommit.de>
	<429D47FD.7090501@streppone.it>
	<429D56B2.9070302@paradise.net.nz>
	<a056b1d405060220451b029a15@mail.gmail.com>

Paul McGarry wrote:

> Based on the powerpostgresql.com Performance Checklist [1]  and
> Annotated Postgresql.conf [2] I understand that:
> -I should have less than 1/3 of my total memory as shared_buffers
> -For my server 15000 is a fairly reasonable starting point for
> shared_buffers which is ~120MB
> -I have 100 max_connections.
> 
> So I was going to set SHMMAX to 134217728 (ie 128 Meg)
> 
> What should SHMALL be?
> 
> The current system values are
> postgres@localhost:~/data$ cat /proc/sys/kernel/shmmax
> 33554432
> postgres@localhost:~/data$ cat /proc/sys/kernel/shmall
> 2097152
> 
> ie SHMALL seems to be 1/16 of SHMMAX
> 

No - shmall is in 4k pages _ so this amounts to 8G! This is fine - 
unless you wish to decrease it in order to prevent too many shared 
memory applications running.

BTW - the docs have been amended for 8.1 to suggest shmmax=134217728 and 
shmall=2097152 (was going to point you at them - but I cannot find them 
on the Postgresql site anymore...).

There seems to be some longstanding confusion in the Linux community 
about the units for shmall (some incorrect documentation from Oracle on 
the issue does not help I am sure....) - to the point where I downloaded 
kernel source to check (reproducing here):


linux-2.6.11.1/include/linux/shm.h:13->

#define SHMMAX 0x2000000         /* max shared seg size (bytes) */
#define SHMMIN 1             /* min shared seg size (bytes) */
#define SHMMNI 4096          /* max num of segs system wide */
#define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide 
(pages) */
#define SHMSEG SHMMNI


Hope that helps

Best wishes

Mark



view thread (5+ messages)  latest in thread

Message-ID: <429FF4AA.7090200@paradise.net.nz>
Permalink:  ../429FF4AA.7090200@paradise.net.nz/
Also on:    postgresql.org/message-id/429FF4AA.7090200@paradise.net.nz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: markir@paradise.net.nz, paul@paulmcgarry.com, cosimo@streppone.it, martin.fandel@alphyra-evs.de
  Subject: Re: SHMMAX / SHMALL Was (Re: postgresql-8.0.1 performance
  In-Reply-To: <429FF4AA.7090200@paradise.net.nz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox