I tried to follow the instructions that are described here:
My values config are:
page size = 4096
BLCKSZ = 8
I'm using FreeBSD 6.2 and I have a test machine with 1GB memory. I would
like to use 25% (256MB) as shared memory.
Here is what I have calculated (Python syntax, but probably everybody
shmmin = \
500*1024 # From the docs: As a rough approximation, you can estimate
the required segment size as 500 kB plus the variable amounts shown in
The result for this was:
Minimum shared mem: 140731400 bytes = 135.0 MB
Maximum shared mem: 268435456 bytes = 256.0 MB
So far I put these values in /boot/loader.conf (they were also
calculated, I followed the recommendations in the docs):
After rebooted I got this message:
Nov 13 20:46:19 neptunus postgres: [1-1] FATAL: could not create
shared memory segment: Invalid argument
Nov 13 20:46:19 neptunus postgres: [1-2] DETAIL: Failed system
call was shmget(key=5432001, size=21725184, 03600).
Nov 13 20:46:19 neptunus postgres: [1-3] HINT: This error usually
means that PostgreSQL's request for a shared memory segment exceeded
your kernel's SHMMAX parameter.
Nov 13 20:46:19 neptunus postgres: [1-4] You can either reduce the
request size or reconfigure the kernel with larger SHMMAX. To reduce
the request size (currently
Nov 13 20:46:19 neptunus postgres: [1-5] 21725184 bytes), reduce
PostgreSQL's shared_buffers parameter (currently 2048) and/or its
max_connections parameter (currently
Nov 13 20:46:19 neptunus postgres: [1-6] 50).
Nov 13 20:46:19 neptunus postgres: [1-7] If the request size is
already small, it's possible that it is less than your kernel's SHMMIN
parameter, in which case raising
Nov 13 20:46:19 neptunus postgres: [1-8] the request size or
reconfiguring SHMMIN is called for.
What is wrong with my calculation?
The reason for this question: I'm writing a program that reads some
input parameters (PostgreSQL and kernel configuration parameters),
queries the computer for kernel page size, total available memory etc.
and finally it calculates sysctl values.
This is not a toy: I have a server with memory problems and I would also
like to find the optimal settings. (e.g. keep shared memory in physical
memory, optimize for performance, but do not reserve more memory than
needed). I would also like to contribute this program so other beginners
will be able to set these parameters easily. My idea was that this
program would warn me whenever there is a problem (e.g. SHMMIN > SHMMAX)
but apparently I could not understand the basics and I failed to write
pgsql-admin by date
|Next:||From: Bruce Momjian||Date: 2007-11-13 20:10:23|
|Subject: Re: where can I find doc for pg_buffercache?|
|Previous:||From: dx k9||Date: 2007-11-13 19:54:10|
|Subject: effective_cache_size v824|