From f1bebef60ec8f557324cd3bfc1671da1318de968 Mon Sep 17 00:00:00 2001 From: Thomas Munro Date: Sun, 3 Feb 2019 09:55:39 +0100 Subject: Add shared_memory_type GUC. Since 9.3 we have used anonymous shared mmap for our main shared memory region, except in EXEC_BACKEND builds. Provide a GUC so that users can opt for System V shared memory once again, like in 9.2 and earlier. A later patch proposes to add huge/large page support for AIX, which requires System V shared memory and provided the motivation to revive this possibility. It may also be useful on some BSDs. Author: Andres Freund (revived and documented by Thomas Munro) Discussion: https://postgr.es/m/HE1PR0202MB28126DB4E0B6621CC6A1A91286D90%40HE1PR0202MB2812.eurprd02.prod.outlook.com Discussion: https://postgr.es/m/2AE143D2-87D3-4AD1-AC78-CE2258230C05%40FreeBSD.org --- doc/src/sgml/config.sgml | 25 +++++++++++++++++++++++++ doc/src/sgml/runtime.sgml | 17 +++++++++++------ 2 files changed, 36 insertions(+), 6 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index b6f5822b847..9b7a7388d5a 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1694,6 +1694,31 @@ include_dir 'conf.d' + + shared_memory_type (enum) + + shared_memory_type configuration parameter + + + + + Specifies the shared memory implementation that the server + should use for the main shared memory region that holds + PostgreSQL's shared buffers and other + shared data. Possible values are mmap (for + anonymous shared memory allocated using mmap), + sysv (for System V shared memory allocated via + shmget) and windows (for Windows + shared memory). Not all values are supported on all platforms; the + first supported option is the default for that platform. The use of + the sysv option, which is not the default on any + platform, is generally discouraged because it typically requires + non-default kernel settings to allow for large allocations (see ). + + + + dynamic_shared_memory_type (enum) diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index 333adda4086..1f78f6c9569 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -638,9 +638,12 @@ psql: could not connect to server: No such file or directory - Upon starting the server, PostgreSQL normally allocates + By default, PostgreSQL allocates a very small amount of System V shared memory, as well as a much larger - amount of POSIX (mmap) shared memory. + amount of anonymous mmap shared memory. + Alternatively, a single large System V shared memory region can be used + (see ). + In addition a significant number of semaphores, which can be either System V or POSIX style, are created at server startup. Currently, POSIX semaphores are used on Linux and FreeBSD systems while other @@ -752,8 +755,10 @@ psql: could not connect to server: No such file or directory PostgreSQL requires a few bytes of System V shared memory (typically 48 bytes, on 64-bit platforms) for each copy of the server. On most modern operating systems, this amount can easily be allocated. - However, if you are running many copies of the server, or if other - applications are also using System V shared memory, it may be necessary to + However, if you are running many copies of the server or you explicitly + configure the server to use large amounts of System V shared memory (see + and ), it may be necessary to increase SHMALL, which is the total amount of System V shared memory system-wide. Note that SHMALL is measured in pages rather than bytes on many systems. @@ -879,7 +884,7 @@ kern.ipc.semmns=512 - You might also want to configure your kernel to lock shared + 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. @@ -928,7 +933,7 @@ kern.ipc.semmns=512 - You might also want to configure your kernel to lock shared + 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. -- cgit v1.2.3