Forum OpenACS Q&A: Response to Server Load Question...

Collapse
Posted by James Thornton on
For the archive...

I was getting this error when trying to start postgres with a block size > the default of 64...

[postgres@roam pgsql]$ /usr/local/pgsql/bin/postmaster -B 2000 -D /usr/local/pgsql/data

IpcMemoryCreate: shmget failed (Invalid argument)
key=5432001, size=33652736, permission=600
This type of error is usually caused by an improper
shared memory or System V IPC semaphore configuration.
For more information, see the FAQ and platform-specific
FAQ's in the source directory pgsql/doc or on our
web site at http://www.postgresql.org.
FATAL 1: ShmemCreate: cannot create region

I found the solution at http://www.ca.postgresql.org/devel-corner/docs/postgres/kernel-resources.html#SYSVIPC-PARAMETERS.

In a nutshell...

[regarding GNU/Linux] The default shared memory limit (both SHMMAX and SHMALL) is 32 MB in 2.2 kernels, but it can be changed in the proc file system (without reboot). For example, to allow 128 MB:

$ echo 134217728 >/proc/sys/kernel/shmall
$ echo 134217728 >/proc/sys/kernel/shmmax

NOTE: 134217728 = 128 * 1024 * 1024

You could put these commands into a script run at boot-time.

Alternatively, you can use sysctl, if available, to control these parameters. Look for a file called /etc/sysctl.conf and add lines like the following to it:

kernel.shmall = 134217728
kernel.shmmax = 134217728

This file is usually processed at boot time, but sysctl can also be called explicitly later.

Other parameters are sufficiently sized for any application. If you want to see for yourself look into /usr/src/linux/include/asm-xxx/shmparam.h and /usr/src/linux/include/linux/sem.h.