mirror of
https://github.com/postgres/postgres.git
synced 2025-05-31 00:01:57 -04:00
Update user docs for switch to POSIX semaphores.
Since commit ecb0d20a9 hasn't crashed and burned, here's the promised docs update for it. In addition to explaining that Linux and FreeBSD ports now use POSIX semaphores, I did some wordsmithing on pre-existing wording; in particular trying to clarify which SysV parameters need to be set with an eye to total usage across all applications.
This commit is contained in:
parent
0137caf273
commit
3d21f08bcc
@ -605,27 +605,47 @@ psql: could not connect to server: No such file or directory
|
|||||||
</indexterm>
|
</indexterm>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Shared memory and semaphores are collectively referred to as
|
<productname>PostgreSQL</> requires the operating system to provide
|
||||||
<quote><systemitem class="osname">System V</>
|
inter-process communication (<acronym>IPC</>) features, specifically
|
||||||
<acronym>IPC</></quote> (together with message queues, which are not
|
shared memory and semaphores. Unix-derived systems typically provide
|
||||||
relevant for <productname>PostgreSQL</>). Except on
|
<quote><systemitem class="osname">System V</></> <acronym>IPC</>,
|
||||||
<systemitem class="osname">Windows</>, where <productname>PostgreSQL</>
|
<quote><systemitem class="osname">POSIX</></> <acronym>IPC</>, or both.
|
||||||
provides its own replacement implementation of these facilities, these
|
<systemitem class="osname">Windows</> has its own implementation of
|
||||||
facilities are required in order to run
|
these features and is not discussed here.
|
||||||
<productname>PostgreSQL</>.
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The complete lack of these facilities is usually manifested by an
|
The complete lack of these facilities is usually manifested by an
|
||||||
<errorname>Illegal system call</> error upon server start. In
|
<quote><errorname>Illegal system call</></quote> error upon server
|
||||||
that case there is no alternative but to reconfigure your
|
start. In that case there is no alternative but to reconfigure your
|
||||||
kernel. <productname>PostgreSQL</> won't work without them.
|
kernel. <productname>PostgreSQL</> won't work without them.
|
||||||
This situation is rare, however, among modern operating systems.
|
This situation is rare, however, among modern operating systems.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
When <productname>PostgreSQL</> exceeds one of the various hard
|
Upon starting the server, <productname>PostgreSQL</> normally allocates
|
||||||
<acronym>IPC</> limits, the server will refuse to start and
|
a very small amount of System V shared memory, as well as a much larger
|
||||||
|
amount of POSIX (<function>mmap</>) shared memory.
|
||||||
|
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
|
||||||
|
platforms use System V semaphores.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<note>
|
||||||
|
<para>
|
||||||
|
Prior to <productname>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.
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
System V <acronym>IPC</> features are typically constrained by
|
||||||
|
system-wide allocation limits.
|
||||||
|
When <productname>PostgreSQL</> exceeds one of these limits,
|
||||||
|
the server will refuse to start and
|
||||||
should leave an instructive error message describing the problem
|
should leave an instructive error message describing the problem
|
||||||
and what to do about it. (See also <xref
|
and what to do about it. (See also <xref
|
||||||
linkend="server-start-failures">.) The relevant kernel
|
linkend="server-start-failures">.) The relevant kernel
|
||||||
@ -634,15 +654,6 @@ psql: could not connect to server: No such file or directory
|
|||||||
them, however, vary. Suggestions for some platforms are given below.
|
them, however, vary. Suggestions for some platforms are given below.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<note>
|
|
||||||
<para>
|
|
||||||
Prior to <productname>PostgreSQL</> 9.3, 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.
|
|
||||||
</para>
|
|
||||||
</note>
|
|
||||||
|
|
||||||
<table id="sysvipc-parameters">
|
<table id="sysvipc-parameters">
|
||||||
<title><systemitem class="osname">System V</> <acronym>IPC</> Parameters</title>
|
<title><systemitem class="osname">System V</> <acronym>IPC</> Parameters</title>
|
||||||
|
|
||||||
@ -651,7 +662,7 @@ psql: could not connect to server: No such file or directory
|
|||||||
<row>
|
<row>
|
||||||
<entry>Name</>
|
<entry>Name</>
|
||||||
<entry>Description</>
|
<entry>Description</>
|
||||||
<entry>Reasonable values</>
|
<entry>Values needed to run one <productname>PostgreSQL</> instance</>
|
||||||
</row>
|
</row>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@ -659,7 +670,7 @@ psql: could not connect to server: No such file or directory
|
|||||||
<row>
|
<row>
|
||||||
<entry><varname>SHMMAX</></>
|
<entry><varname>SHMMAX</></>
|
||||||
<entry>Maximum size of shared memory segment (bytes)</>
|
<entry>Maximum size of shared memory segment (bytes)</>
|
||||||
<entry>at least 1kB (more if running many copies of the server)</entry>
|
<entry>at least 1kB, but the default is usually much higher</entry>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
<row>
|
<row>
|
||||||
@ -671,7 +682,9 @@ psql: could not connect to server: No such file or directory
|
|||||||
<row>
|
<row>
|
||||||
<entry><varname>SHMALL</></>
|
<entry><varname>SHMALL</></>
|
||||||
<entry>Total amount of shared memory available (bytes or pages)</>
|
<entry>Total amount of shared memory available (bytes or pages)</>
|
||||||
<entry>if bytes, same as <varname>SHMMAX</varname>; if pages, <literal>ceil(SHMMAX/PAGE_SIZE)</literal></>
|
<entry>same as <varname>SHMMAX</varname> if bytes,
|
||||||
|
or <literal>ceil(SHMMAX/PAGE_SIZE)</literal> if pages,
|
||||||
|
plus room for other applications</>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
<row>
|
<row>
|
||||||
@ -689,7 +702,7 @@ psql: could not connect to server: No such file or directory
|
|||||||
<row>
|
<row>
|
||||||
<entry><varname>SEMMNI</></>
|
<entry><varname>SEMMNI</></>
|
||||||
<entry>Maximum number of semaphore identifiers (i.e., sets)</>
|
<entry>Maximum number of semaphore identifiers (i.e., sets)</>
|
||||||
<entry>at least <literal>ceil((max_connections + autovacuum_max_workers + max_worker_processes + 5) / 16)</literal></>
|
<entry>at least <literal>ceil((max_connections + autovacuum_max_workers + max_worker_processes + 5) / 16)</literal> plus room for other applications</>
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
<row>
|
<row>
|
||||||
@ -725,9 +738,8 @@ psql: could not connect to server: No such file or directory
|
|||||||
(typically 48 bytes, on 64-bit platforms) for each copy of the server.
|
(typically 48 bytes, on 64-bit platforms) for each copy of the server.
|
||||||
On most modern operating systems, this amount can easily be allocated.
|
On most modern operating systems, this amount can easily be allocated.
|
||||||
However, if you are running many copies of the server, or if other
|
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
|
applications are also using System V shared memory, it may be necessary to
|
||||||
to increase <varname>SHMMAX</>, the maximum size in bytes of a shared
|
increase <varname>SHMALL</>, which is the total amount of System V shared
|
||||||
memory segment, or <varname>SHMALL</>, the total amount of System V shared
|
|
||||||
memory system-wide. Note that <varname>SHMALL</> is measured in pages
|
memory system-wide. Note that <varname>SHMALL</> is measured in pages
|
||||||
rather than bytes on many systems.
|
rather than bytes on many systems.
|
||||||
</para>
|
</para>
|
||||||
@ -742,6 +754,7 @@ psql: could not connect to server: No such file or directory
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
When using System V semaphores,
|
||||||
<productname>PostgreSQL</> uses one semaphore per allowed connection
|
<productname>PostgreSQL</> uses one semaphore per allowed connection
|
||||||
(<xref linkend="guc-max-connections">), allowed autovacuum worker process
|
(<xref linkend="guc-max-connections">), allowed autovacuum worker process
|
||||||
(<xref linkend="guc-autovacuum-max-workers">) and allowed background
|
(<xref linkend="guc-autovacuum-max-workers">) and allowed background
|
||||||
@ -779,15 +792,19 @@ psql: could not connect to server: No such file or directory
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The <varname>SEMMSL</> parameter, which determines how many
|
Various other settings related to <quote>semaphore undo</>, such as
|
||||||
semaphores can be in a set, must be at least 17 for
|
<varname>SEMMNU</> and <varname>SEMUME</>, do not affect
|
||||||
<productname>PostgreSQL</>.
|
<productname>PostgreSQL</>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Various other settings related to <quote>semaphore undo</>, such as
|
When using POSIX semaphores, the number of semaphores needed is the
|
||||||
<varname>SEMMNU</> and <varname>SEMUME</>, do not affect
|
same as for System V, that is one semaphore per allowed connection
|
||||||
<productname>PostgreSQL</>.
|
(<xref linkend="guc-max-connections">), allowed autovacuum worker process
|
||||||
|
(<xref linkend="guc-autovacuum-max-workers">) and allowed background
|
||||||
|
process (<xref linkend="guc-max-worker-processes">).
|
||||||
|
On the platforms where this option is preferred, there is no specific
|
||||||
|
kernel limit on the number of POSIX semaphores.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user