Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 388c7e2

Browse files
committed
Update discussion of shared memory sizing for 8.3: adjust multipliers,
mention autovacuum_max_workers. Minor copy-editing too.
1 parent 5c99688 commit 388c7e2

File tree

1 file changed

+40
-26
lines changed

1 file changed

+40
-26
lines changed

doc/src/sgml/runtime.sgml

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.381 2007/03/30 03:19:02 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.382 2007/11/01 19:06:01 tgl Exp $ -->
22

33
<chapter Id="runtime">
44
<title>Operating System Environment</title>
@@ -478,9 +478,10 @@ psql: could not connect to server: No such file or directory
478478
relevant for <productname>PostgreSQL</>). Almost all modern
479479
operating systems provide these features, but not all of them have
480480
them turned on or sufficiently sized by default, especially systems
481-
with BSD heritage. (For the <systemitem class="osname">Windows</>
482-
port, <productname>PostgreSQL</> provides its own replacement
483-
implementation of these facilities.)
481+
with BSD heritage. (On <systemitem class="osname">Windows</>,
482+
<productname>PostgreSQL</> provides its own replacement
483+
implementation of these facilities, and so most of this section
484+
can be disregarded.)
484485
</para>
485486

486487
<para>
@@ -550,13 +551,13 @@ psql: could not connect to server: No such file or directory
550551
<row>
551552
<entry><varname>SEMMNI</></>
552553
<entry>Maximum number of semaphore identifiers (i.e., sets)</>
553-
<entry>at least <literal>ceil(max_connections / 16)</literal></>
554+
<entry>at least <literal>ceil((max_connections + autovacuum_max_workers) / 16)</literal></>
554555
</row>
555556

556557
<row>
557558
<entry><varname>SEMMNS</></>
558559
<entry>Maximum number of semaphores system-wide</>
559-
<entry><literal>ceil(max_connections / 16) * 17</literal> plus room for other applications</>
560+
<entry><literal>ceil((max_connections + autovacuum_max_workers) / 16) * 17</literal> plus room for other applications</>
560561
</row>
561562

562563
<row>
@@ -587,18 +588,16 @@ psql: could not connect to server: No such file or directory
587588
shared memory parameter is <varname>SHMMAX</>, the maximum size, in
588589
bytes, of a shared memory segment. If you get an error message from
589590
<function>shmget</> like <errorname>Invalid argument</>, it is
590-
likely that this limit has been exceeded. The size of the required
591+
likely that this limit has been exceeded. The size of the required
591592
shared memory segment varies depending on several
592593
<productname>PostgreSQL</> configuration parameters, as shown in
593-
<xref linkend="shared-memory-parameters">.
594+
<xref linkend="shared-memory-parameters">. (Any error message you might
595+
get will include the exact size of the failed allocation request.)
594596
You can, as a temporary solution, lower some of those settings to
595-
avoid the failure. As a rough approximation, you can estimate the
596-
required segment size as 500 kB plus the variable amounts shown in
597-
the table. (Any error message you might get will include the exact
598-
size of the failed allocation request.) While it is possible to get
597+
avoid the failure. While it is possible to get
599598
<productname>PostgreSQL</> to run with <varname>SHMMAX</> as small as
600-
1 MB, you need at least 4 MB for acceptable performance, and desirable
601-
settings are in the tens of megabytes.
599+
2 MB, you need considerably more for acceptable performance. Desirable
600+
settings are in the tens to hundreds of megabytes.
602601
</para>
603602

604603
<para>
@@ -620,17 +619,21 @@ psql: could not connect to server: No such file or directory
620619

621620
<para>
622621
<productname>PostgreSQL</> uses one semaphore per allowed connection
623-
(<xref linkend="guc-max-connections">), in sets of 16. Each such set will
622+
(<xref linkend="guc-max-connections">) and allowed autovacuum worker
623+
process (<xref linkend="guc-autovacuum-max-workers">), in sets of 16.
624+
Each such set will
624625
also contain a 17th semaphore which contains a <quote>magic
625626
number</quote>, to detect collision with semaphore sets used by
626627
other applications. The maximum number of semaphores in the system
627628
is set by <varname>SEMMNS</>, which consequently must be at least
628-
as high as <varname>max_connections</> plus one extra for each 16
629-
allowed connections (see the formula in <xref
629+
as high as <varname>max_connections</> plus
630+
<varname>autovacuum_max_workers</>, plus one extra for each 16
631+
allowed connections plus workers (see the formula in <xref
630632
linkend="sysvipc-parameters">). The parameter <varname>SEMMNI</>
631633
determines the limit on the number of semaphore sets that can
632634
exist on the system at one time. Hence this parameter must be at
633-
least <literal>ceil(max_connections / 16)</>. Lowering the number
635+
least <literal>ceil((max_connections + autovacuum_max_workers) / 16)</>.
636+
Lowering the number
634637
of allowed connections is a temporary workaround for failures,
635638
which are usually confusingly worded <errorname>No space
636639
left on device</>, from the function <function>semget</>.
@@ -675,7 +678,7 @@ psql: could not connect to server: No such file or directory
675678
sort of configuration commonly used for other databases such
676679
as <application>DB/2</application>.</para>
677680

678-
<para> It might , however, be necessary to modify the global
681+
<para> It might, however, be necessary to modify the global
679682
<command>ulimit</command> information in
680683
<filename>/etc/security/limits</filename>, as the default hard
681684
limits for file sizes (<varname>fsize</varname>) and numbers of
@@ -865,8 +868,9 @@ options SEMMAP=256
865868
<indexterm><primary>Linux</><secondary>IPC configuration</></>
866869
<listitem>
867870
<para>
868-
The default settings are only suitable for small installations
869-
(the default maximum segment size is 32 MB). However, the remaining
871+
The default maximum segment size is 32 MB, which is only adequate
872+
for small <productname>PostgreSQL</productname> installations.
873+
However, the remaining
870874
defaults are quite generously sized, and usually do not require
871875
changes. The maximum shared memory segment size can be changed via the
872876
<command>sysctl</command> interface. For example, to allow 128 MB,
@@ -985,7 +989,7 @@ kern.sysv.shmall=1024
985989
<listitem>
986990
<para>
987991
At least in version 2.6, the default maximum size of a shared
988-
memory segments is too low for <productname>PostgreSQL</>. The
992+
memory segment is too low for <productname>PostgreSQL</>. The
989993
relevant settings can be changed in <filename>/etc/system</>,
990994
for example:
991995
<programlisting>
@@ -1051,24 +1055,29 @@ set semsys:seminfo_semmsl=32
10511055
<thead>
10521056
<row>
10531057
<entry>Name</>
1054-
<entry>Approximate multiplier (bytes per increment)</>
1058+
<entry>Approximate multiplier (bytes per increment) as of 8.3</>
10551059
</row>
10561060
</thead>
10571061

10581062
<tbody>
10591063
<row>
10601064
<entry><xref linkend="guc-max-connections"></>
1061-
<entry>400 + 270 * <xref linkend="guc-max-locks-per-transaction"></entry>
1065+
<entry>1800 + 270 * <xref linkend="guc-max-locks-per-transaction"></entry>
1066+
</row>
1067+
1068+
<row>
1069+
<entry><xref linkend="guc-autovacuum-max-workers"></>
1070+
<entry>1800 + 270 * <xref linkend="guc-max-locks-per-transaction"></entry>
10621071
</row>
10631072

10641073
<row>
10651074
<entry><xref linkend="guc-max-prepared-transactions"></>
1066-
<entry>600 + 270 * <xref linkend="guc-max-locks-per-transaction"></entry>
1075+
<entry>770 + 270 * <xref linkend="guc-max-locks-per-transaction"></entry>
10671076
</row>
10681077

10691078
<row>
10701079
<entry><xref linkend="guc-shared-buffers"></>
1071-
<entry>8300 (assuming 8 kB <symbol>BLCKSZ</>)</entry>
1080+
<entry>8400 (assuming 8 kB <symbol>BLCKSZ</>)</entry>
10721081
</row>
10731082

10741083
<row>
@@ -1085,6 +1094,11 @@ set semsys:seminfo_semmsl=32
10851094
<entry><xref linkend="guc-max-fsm-pages"></>
10861095
<entry>6</>
10871096
</row>
1097+
1098+
<row>
1099+
<entry>Fixed space requirements</>
1100+
<entry>770 kB</entry>
1101+
</row>
10881102
</tbody>
10891103
</tgroup>
10901104
</table>

0 commit comments

Comments
 (0)