Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Dec 2010 19:55:26 -0500
From:      Bill Moran <wmoran@potentialtech.com>
To:        Laszlo Nagy <gandalf@shopzeus.com>
Cc:        questions@freebsd.org, danieleff@gmail.com
Subject:   Re: What is loading my server so much?
Message-ID:  <20101209195526.e09b488d.wmoran@potentialtech.com>
In-Reply-To: <4D016302.70505@shopzeus.com>
References:  <4D00BDF8.6020206@shopzeus.com> <20101209083818.e622a146.wmoran@potentialtech.com> <4D016302.70505@shopzeus.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 10 Dec 2010 00:15:14 +0100
Laszlo Nagy <gandalf@shopzeus.com> wrote:

> 
> > First off, you have 24G of RAM available and PostgreSQL only seems to
> > have access to 400M of it.  Bump shared_buffers up to 2 or 3 G at least,
> > and bump up work_mem to at least a few hundred meg, and
> > maintenance_work_mem up to at 1/2G or so.
> 
> All right. Here is what I did. I setup a new shmmax value this way:
> 
> sysctl kern.ipc.shmmax=8589934592
> 
> It is 8G.  (By the way I also have kern.ipc.shm_use_phys: 1 ) Then I 
> have changed shared_mem to 1024MB in postgresql.conf.
> Then I tried to start postgresql I got this message in the log:
> 
> Dec  9 17:53:59 shopzeus postgres[27247]: [1-4]         The PostgreSQL 
> documentation contains more information about shared memory configuration.
> Dec  9 17:55:52 shopzeus postgres[27328]: [1-1] FATAL:  could not create 
> shared memory segment: Cannot allocate memory
> Dec  9 17:55:52 shopzeus postgres[27328]: [1-2] DETAIL:  Failed system 
> call was shmget(key=5432001, size=1105051648, 03600).
> Dec  9 17:55:52 shopzeus postgres[27328]: [1-3] HINT:  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 1105051648 bytes), reduce PostgreSQL's shared_buffers 
> parameter (currently 131072) and/or its max_connections parameter 
> (currently 203).
> Dec  9 17:55:52 shopzeus postgres[27328]: [1-4]         The PostgreSQL 
> documentation contains more information about shared memory configuration.
> 
> I do not understand.
> 
> Doc says these:
> 
> "max_connections cost ~ 400 bytes of shared memory slot, plus lock space 
> (see max_locks_per_transaction)."
> 
> Even if I had max_connections = 5000, total shared memory required would 
> be way below shmmax=8G.
> 
> What am I missing here?

Did you bump kern.ipc.shmall?  The one you bumped is the maximum size of
a single shared memory request, shmall is the maximum amount of shared
memory for the entire system.  They both have to be increased.  To make
it more confusing, shmall is in pages, not bytes, so you have to divide
by pagesize (sysctl hw.pagesize).

-Bill



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101209195526.e09b488d.wmoran>