|PostgreSQL Reference Manual - Volume 3 - Server Administration Guide|
by The PostgreSQL Global Development Group
Paperback (6"x9"), 204 pages
RRP £13.95 ($24.95)
Sales of this book support the PostgreSQL project! Get a printed copy>>>
3.4.3 Linux Memory Overcommit
In Linux 2.4 and later, the default virtual memory behavior is not optimal for PostgreSQL. Because of the way that the kernel implements memory overcommit, the kernel may terminate the PostgreSQL server (the master server process) if the memory demands of another process cause the system to run out of virtual memory.
If this happens, you will see a kernel message that looks like this (consult your system documentation and configuration on where to look for such a message):
Out of Memory: Killed process 12345 (postgres).
This indicates that the ‘postgres’ process has been terminated due to memory pressure. Although existing database connections will continue to function normally, no new connections will be accepted. To recover, PostgreSQL will need to be restarted.
One way to avoid this problem is to run PostgreSQL on a machine where you can be sure that other processes will not run the machine out of memory.
On Linux 2.6 and later, a better solution is to modify the kernel's
behavior so that it will not “overcommit” memory. This is
done by selecting strict overcommit mode via
sysctl -w vm.overcommit_memory=2
or placing an equivalent entry in ‘/etc/sysctl.conf’.
You may also wish to modify the related setting
vm.overcommit_ratio. For details see the kernel documentation
Some vendors' Linux 2.4 kernels are reported to have early versions
of the 2.6 overcommit
sysctl parameter. However, setting
vm.overcommit_memory to 2
on a kernel that does not have the relevant code will make
things worse not better. It is recommended that you inspect
the actual kernel source code (see the function
vm_enough_memory in the file ‘mm/mmap.c’)
to verify what is supported in your copy before you try this in a 2.4
installation. The presence of the ‘overcommit-accounting’
documentation file should not be taken as evidence that the
feature is there. If in any doubt, consult a kernel expert or your
|ISBN 0954612043||PostgreSQL Reference Manual - Volume 3 - Server Administration Guide||See the print edition|