From: Peter Eisentraut Date: Sat, 13 Mar 2010 11:00:19 +0000 (+0000) Subject: Update shared memory configuration information for Linux X-Git-Tag: REL9_0_ALPHA5~101 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8b2ae44dc8dd56511c7004c5b117b720081dc8fb;p=postgresql Update shared memory configuration information for Linux In particular, the assertion that shmall is sufficiently sized by default is slowly becoming untrue. --- diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index 97e2c9807e..1eaab51105 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -1,4 +1,4 @@ - + Server Setup and Operation @@ -522,9 +522,10 @@ psql: could not connect to server: No such file or directory System V IPC (together with message queues, which are not relevant for PostgreSQL). Almost all modern - operating systems provide these features, but not all of them have - them turned on or sufficiently sized by default, especially systems - with a BSD heritage. (On Windows, + operating systems provide these features, but many of them don't have + them turned on or sufficiently sized by default, especially as + available RAM and the demands of database applications grow. + (On Windows, PostgreSQL provides its own replacement implementation of these facilities, so most of this section can be disregarded.) @@ -535,6 +536,7 @@ psql: could not connect to server: No such file or directory Illegal system call error upon server start. In that case there is no alternative but to reconfigure your kernel. PostgreSQL won't work without them. + This situation is rare, however, among modern operating systems. @@ -546,8 +548,6 @@ psql: could not connect to server: No such file or directory parameters are named consistently across different systems; gives an overview. The methods to set them, however, vary. Suggestions for some platforms are given below. - Be warned that it is often necessary to reboot your machine, and - possibly even recompile the kernel, to change these settings. @@ -643,15 +643,15 @@ psql: could not connect to server: No such file or directory avoid the failure. While it is possible to get PostgreSQL to run with SHMMAX as small as 2 MB, you need considerably more for acceptable performance. Desirable - settings are in the tens to hundreds of megabytes. + settings are in the hundreds of megabytes to a few gigabytes. Some systems also have a limit on the total amount of shared memory in the system (SHMALL). Make sure this is large enough for PostgreSQL plus any other applications that - are using shared memory segments. (Caution: SHMALL - is measured in pages rather than bytes on many systems.) + are using shared memory segments. Note that SHMALL + is measured in pages rather than bytes on many systems. @@ -898,30 +898,41 @@ options SEMMAP=256 The default maximum segment size is 32 MB, which is only adequate - for small PostgreSQL installations. - However, the remaining - defaults are quite generously sized, and usually do not require - changes. The maximum shared memory segment size can be changed via the - sysctl interface. For example, to allow 128 MB, - and explicitly set the maximum total shared memory size to 2097152 - pages (the default): + for very small PostgreSQL + installations. The default maximum total size is 2097152 + pages. A page is almost always 4096 bytes except in unusual + kernel configurations with huge pages + (use getconf PAGE_SIZE to verify). That + makes a default limit of 8 GB, which is often enough, but not + always. + + + + The shared memory size settings can be changed via the + sysctl interface. For example, to allow 16 GB: -$ sysctl -w kernel.shmmax=134217728 -$ sysctl -w kernel.shmall=2097152 +$ sysctl -w kernel.shmmax=17179869184 +$ sysctl -w kernel.shmall=4194304 - In addition these settings can be preserved between reboots in - the file /etc/sysctl.conf. + In addition these settings can be preserved between reboots in + the file /etc/sysctl.conf. Doing that is + highly recommended. - Older distributions might not have the sysctl program, + Ancient distributions might not have the sysctl program, but equivalent changes can be made by manipulating the /proc file system: -$ echo 134217728 >/proc/sys/kernel/shmmax -$ echo 2097152 >/proc/sys/kernel/shmall +$ echo 17179869184 >/proc/sys/kernel/shmmax +$ echo 4194304 >/proc/sys/kernel/shmall + + + The remaining defaults are quite generously sized, and usually + do not require changes. +