From c8be915aa9fcc4c0cba563ddbb2e5af7a2dadd12 Mon Sep 17 00:00:00 2001 From: Thomas Munro Date: Sun, 7 Jun 2020 21:36:43 +1200 Subject: [PATCH] Doc: Clean up references to obsolete OS versions. Remove obsolete instructions for old operating system versions, and update the text to reflect the defaults on modern systems. Reviewed-by: Tom Lane Reviewed-by: Peter Eisentraut Reviewed-by: Magnus Hagander Discussion: https://postgr.es/m/CA%2BhUKGLmJUSwybaPQv39rB8ABpqJq84im2UjZvyUY4feYhpWMw%40mail.gmail.com --- doc/src/sgml/runtime.sgml | 275 +++++++++----------------------------- 1 file changed, 62 insertions(+), 213 deletions(-) diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index a8bb85e6f5a..1b2012d34a9 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -538,12 +538,12 @@ DETAIL: Failed system call was shmget(key=5440001, size=4011376640, 03600). probably means your kernel's limit on the size of shared memory is smaller than the work area PostgreSQL - is trying to create (4011376640 bytes in this example). Or it could - mean that you do not have System-V-style shared memory support - configured into your kernel at all. As a temporary workaround, you + is trying to create (4011376640 bytes in this example). + This is only likely to happen if you have set shared_memory_type + to sysv. In that case, you can try starting the server with a smaller-than-normal number of - buffers (). You will eventually want - to reconfigure your kernel to increase the allowed shared memory + buffers (), or + reconfigure your kernel to increase the allowed shared memory size. You might also see this message when trying to start multiple servers on the same machine, if their total space requested exceeds the kernel limit. @@ -565,13 +565,6 @@ DETAIL: Failed system call was semget(5440126, 17, 03600). increase the kernel limit. - - If you get an illegal system call error, it is likely that - shared memory or semaphores are not supported in your kernel at - all. In that case your only option is to reconfigure the kernel to - enable these features. - - Details about configuring System V IPC facilities are given in . @@ -662,14 +655,6 @@ psql: could not connect to server: No such file or directory these features and is not discussed here. - - The complete lack of these facilities is usually manifested by an - 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. - - By default, PostgreSQL allocates a very small amount of System V shared memory, as well as a much larger @@ -683,15 +668,6 @@ psql: could not connect to server: No such file or directory platforms use System V semaphores. - - - Prior to PostgreSQL 9.3, only System V shared memory - was used, so the amount of System V shared memory required to start the - server was much larger. If you are running an older version of the - server, please consult the documentation for your server version. - - - System V IPC features are typically constrained by system-wide allocation limits. @@ -872,7 +848,7 @@ psql: could not connect to server: No such file or directory - At least as of version 5.1, it should not be necessary to do + It should not be necessary to do any special configuration for such parameters as SHMMAX, as it appears this is configured to allow all memory to be used as shared memory. That is the @@ -894,6 +870,12 @@ psql: could not connect to server: No such file or directory FreeBSDIPC configuration + + The default shared memory settings are usually good enough, unless + you have set shared_memory_type to sysv. + System V semaphores are not used on this platform. + + The default IPC settings can be changed using the sysctl or @@ -908,40 +890,22 @@ psql: could not connect to server: No such file or directory - These semaphore-related settings are read-only as far as - sysctl is concerned, but can be set in - /boot/loader.conf: - -kern.ipc.semmni=256 -kern.ipc.semmns=512 - - After modifying that file, a reboot is required for the new - settings to take effect. - - - - You might also want to configure your kernel to lock System V shared - memory into RAM and prevent it from being paged out to swap. - This can be accomplished using the sysctl + If you have set shared_memory_type to + sysv, you might also want to configure your kernel + to lock System V shared memory into RAM and prevent it from being paged + out to swap. This can be accomplished using the sysctl setting kern.ipc.shm_use_phys. - If running in FreeBSD jails by enabling sysctl's - security.jail.sysvipc_allowed, postmasters - running in different jails should be run by different operating system - users. This improves security because it prevents non-root users - from interfering with shared memory or semaphores in different jails, - and it allows the PostgreSQL IPC cleanup code to function properly. - (In FreeBSD 6.0 and later the IPC cleanup code does not properly detect - processes in other jails, preventing the running of postmasters on the - same port in different jails.) + If running in a FreeBSD jail, you should set its + sysvshm parameter to new, so that + it has its own separate System V shared memory namespace. + (Before FreeBSD 11.0, it was necessary to enable shared access to + the host's IPC namespace from jails, and take measures to avoid + collisions.) - - FreeBSD versions before 4.0 work like - old OpenBSD (see below). - @@ -951,7 +915,15 @@ kern.ipc.semmns=512 - In NetBSD 5.0 and later, + The default shared memory settings are usually good enough, unless + you have set shared_memory_type to sysv. + You will usually want to increase kern.ipc.semmni + and kern.ipc.semmns, + as NetBSD's default settings + for these are uncomfortably small. + + + IPC parameters can be adjusted using sysctl, for example: @@ -962,25 +934,12 @@ kern.ipc.semmns=512 - You will usually want to increase kern.ipc.semmni - and kern.ipc.semmns, - as NetBSD's default settings - for these are uncomfortably small. - - - - You might also want to configure your kernel to lock System V shared - memory into RAM and prevent it from being paged out to swap. - This can be accomplished using the sysctl + If you have set shared_memory_type to + sysv, you might also want to configure your kernel + to lock System V shared memory into RAM and prevent it from being paged + out to swap. This can be accomplished using the sysctl setting kern.ipc.shm_use_phys. - - - NetBSD versions before 5.0 - work like old OpenBSD - (see below), except that kernel parameters should be set with the - keyword options not option. - @@ -990,17 +949,8 @@ kern.ipc.semmns=512 - In OpenBSD 3.3 and later, - IPC parameters can be adjusted using sysctl, - for example: - -# sysctl kern.seminfo.semmni=100 - - To make these settings persist over reboots, modify - /etc/sysctl.conf. - - - + The default shared memory settings are usually good enough, unless + you have set shared_memory_type to sysv. You will usually want to increase kern.seminfo.semmni and kern.seminfo.semmns, @@ -1009,22 +959,13 @@ kern.ipc.semmns=512 - In older OpenBSD versions, - you will need to build a custom kernel to change the IPC parameters. - Make sure that the options SYSVSHM - and SYSVSEM are enabled, too. (They are by - default.) The following shows an example of how to set the various - parameters in the kernel configuration file: - -option SYSVSHM -option SHMMAXPGS=4096 -option SHMSEG=256 - -option SYSVSEM -option SEMMNI=256 -option SEMMNS=512 -option SEMMNU=256 - + IPC parameters can be adjusted using sysctl, + for example: + +# sysctl kern.seminfo.semmni=100 + + To make these settings persist over reboots, modify + /etc/sysctl.conf. @@ -1037,9 +978,6 @@ option SEMMNU=256 The default settings tend to suffice for normal installations. - On HP-UX 10, the factory default for - SEMMNS is 128, which might be too low for larger - database sites. IPC parameters can be set in the System @@ -1058,11 +996,10 @@ option SEMMNU=256 - The default maximum segment size is 32 MB, and 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). + The default shared memory settings are usually good enough, unless + you have set shared_memory_type to sysv, + and even then only on older kernel versions that shipped with low defaults. + System V semaphores are not used on this platform. @@ -1072,25 +1009,10 @@ option SEMMNU=256 $ 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. Doing that is - highly recommended. + To make these settings persist over reboots, see + /etc/sysctl.conf. - - Ancient distributions might not have the sysctl program, - but equivalent changes can be made by manipulating the - /proc file system: - -$ 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. - @@ -1100,6 +1022,10 @@ option SEMMNU=256 macOSIPC configuration + + The default shared memory and semaphore settings are usually good enough, unless + you have set shared_memory_type to sysv. + The recommended method for configuring shared memory in macOS is to create a file named /etc/sysctl.conf, @@ -1117,8 +1043,7 @@ kern.sysv.shmall=1024 - Beware that recent releases of macOS ignore attempts to set - SHMMAX to a value that isn't an exact multiple of 4096. + SHMMAX can only be set to a multiple of 4096. @@ -1126,75 +1051,22 @@ kern.sysv.shmall=1024 - In older macOS versions, you will need to reboot to have changes in the - shared memory parameters take effect. As of 10.5 it is possible to - change all but SHMMNI on the fly, using + It is possible to change all but SHMMNI on the fly, using sysctl. But it's still best to set up your preferred values via /etc/sysctl.conf, so that the values will be kept across reboots. - - The file /etc/sysctl.conf is only honored in macOS - 10.3.9 and later. If you are running a previous 10.3.x release, - you must edit the file /etc/rc - and change the values in the following commands: - -sysctl -w kern.sysv.shmmax -sysctl -w kern.sysv.shmmin -sysctl -w kern.sysv.shmmni -sysctl -w kern.sysv.shmseg -sysctl -w kern.sysv.shmall - - Note that - /etc/rc is usually overwritten by macOS system updates, - so you should expect to have to redo these edits after each update. - - - - In macOS 10.2 and earlier, instead edit these commands in the file - /System/Library/StartupItems/SystemTuning/SystemTuning. - - - - - - - Solaris 2.6 to 2.9 (Solaris - 6 to Solaris 9) - SolarisIPC configuration - - - - The relevant settings can be changed in - /etc/system, for example: - -set shmsys:shminfo_shmmax=0x2000000 -set shmsys:shminfo_shmmin=1 -set shmsys:shminfo_shmmni=256 -set shmsys:shminfo_shmseg=256 - -set semsys:seminfo_semmap=256 -set semsys:seminfo_semmni=512 -set semsys:seminfo_semmns=512 -set semsys:seminfo_semmsl=32 - - You need to reboot for the changes to take effect. See also - - for information on shared memory under older versions of Solaris. - - Solaris 2.10 (Solaris - 10) and later - OpenSolaris + Solaris + illumos - In Solaris 10 and later, and OpenSolaris, the default shared memory and - semaphore settings are good enough for most - PostgreSQL applications. Solaris now defaults + The default shared memory and semaphore settings are usually good enough for most + PostgreSQL applications. Solaris defaults to a SHMMAX of one-quarter of system RAM. To further adjust this setting, use a project setting associated with the postgres user. For example, run the @@ -1415,7 +1287,7 @@ default:\ - In Linux 2.4 and later, the default virtual memory behavior is not + The default virtual memory behavior on Linux is not optimal for PostgreSQL. Because of the way that the kernel implements memory overcommit, the kernel might terminate the PostgreSQL postmaster (the @@ -1462,7 +1334,7 @@ Out of Memory: Killed process 12345 (postgres). - On Linux 2.6 and later, it is possible to modify the + It is possible to modify the kernel's behavior so that it will not overcommit memory. Although this setting will not prevent the OOM killer from being invoked @@ -1507,29 +1379,6 @@ export PG_OOM_ADJUST_VALUE=0 whole point is to ensure that the postmaster has a preferential setting. - - Older Linux kernels do not offer /proc/self/oom_score_adj, - but may have a previous version of the same functionality called - /proc/self/oom_adj. This works the same except the disable - value is -17 not -1000. - - - - - 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 2.4 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 kernel 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 - kernel vendor. - -