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

Commit 8b2ae44

Browse files
committed
Update shared memory configuration information for Linux
In particular, the assertion that shmall is sufficiently sized by default is slowly becoming untrue.
1 parent 5473df9 commit 8b2ae44

File tree

1 file changed

+34
-23
lines changed

1 file changed

+34
-23
lines changed

doc/src/sgml/runtime.sgml

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.431 2010/02/03 17:25:06 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.432 2010/03/13 11:00:19 petere Exp $ -->
22

33
<chapter Id="runtime">
44
<title>Server Setup and Operation</title>
@@ -522,9 +522,10 @@ psql: could not connect to server: No such file or directory
522522
<quote><systemitem class="osname">System V</>
523523
<acronym>IPC</></quote> (together with message queues, which are not
524524
relevant for <productname>PostgreSQL</>). Almost all modern
525-
operating systems provide these features, but not all of them have
526-
them turned on or sufficiently sized by default, especially systems
527-
with a BSD heritage. (On <systemitem class="osname">Windows</>,
525+
operating systems provide these features, but many of them don't have
526+
them turned on or sufficiently sized by default, especially as
527+
available RAM and the demands of database applications grow.
528+
(On <systemitem class="osname">Windows</>,
528529
<productname>PostgreSQL</> provides its own replacement
529530
implementation of these facilities, so most of this section
530531
can be disregarded.)
@@ -535,6 +536,7 @@ psql: could not connect to server: No such file or directory
535536
<errorname>Illegal system call</> error upon server start. In
536537
that case there is no alternative but to reconfigure your
537538
kernel. <productname>PostgreSQL</> won't work without them.
539+
This situation is rare, however, among modern operating systems.
538540
</para>
539541

540542
<para>
@@ -546,8 +548,6 @@ psql: could not connect to server: No such file or directory
546548
parameters are named consistently across different systems; <xref
547549
linkend="sysvipc-parameters"> gives an overview. The methods to set
548550
them, however, vary. Suggestions for some platforms are given below.
549-
Be warned that it is often necessary to reboot your machine, and
550-
possibly even recompile the kernel, to change these settings.
551551
</para>
552552

553553

@@ -643,15 +643,15 @@ psql: could not connect to server: No such file or directory
643643
avoid the failure. While it is possible to get
644644
<productname>PostgreSQL</> to run with <varname>SHMMAX</> as small as
645645
2 MB, you need considerably more for acceptable performance. Desirable
646-
settings are in the tens to hundreds of megabytes.
646+
settings are in the hundreds of megabytes to a few gigabytes.
647647
</para>
648648

649649
<para>
650650
Some systems also have a limit on the total amount of shared memory in
651651
the system (<varname>SHMALL</>). Make sure this is large enough
652652
for <productname>PostgreSQL</> plus any other applications that
653-
are using shared memory segments. (Caution: <varname>SHMALL</>
654-
is measured in pages rather than bytes on many systems.)
653+
are using shared memory segments. Note that <varname>SHMALL</>
654+
is measured in pages rather than bytes on many systems.
655655
</para>
656656

657657
<para>
@@ -898,30 +898,41 @@ options SEMMAP=256
898898
<listitem>
899899
<para>
900900
The default maximum segment size is 32 MB, which is only adequate
901-
for small <productname>PostgreSQL</productname> installations.
902-
However, the remaining
903-
defaults are quite generously sized, and usually do not require
904-
changes. The maximum shared memory segment size can be changed via the
905-
<command>sysctl</command> interface. For example, to allow 128 MB,
906-
and explicitly set the maximum total shared memory size to 2097152
907-
pages (the default):
901+
for very small <productname>PostgreSQL</productname>
902+
installations. The default maximum total size is 2097152
903+
pages. A page is almost always 4096 bytes except in unusual
904+
kernel configurations with <quote>huge pages</quote>
905+
(use <literal>getconf PAGE_SIZE</literal> to verify). That
906+
makes a default limit of 8 GB, which is often enough, but not
907+
always.
908+
</para>
909+
910+
<para>
911+
The shared memory size settings can be changed via the
912+
<command>sysctl</command> interface. For example, to allow 16 GB:
908913
<screen>
909-
<prompt>$</prompt> <userinput>sysctl -w kernel.shmmax=134217728</userinput>
910-
<prompt>$</prompt> <userinput>sysctl -w kernel.shmall=2097152</userinput>
914+
<prompt>$</prompt> <userinput>sysctl -w kernel.shmmax=17179869184</userinput>
915+
<prompt>$</prompt> <userinput>sysctl -w kernel.shmall=4194304</userinput>
911916
</screen>
912-
In addition these settings can be preserved between reboots in
913-
the file <filename>/etc/sysctl.conf</filename>.
917+
In addition these settings can be preserved between reboots in
918+
the file <filename>/etc/sysctl.conf</filename>. Doing that is
919+
highly recommended.
914920
</para>
915921

916922
<para>
917-
Older distributions might not have the <command>sysctl</command> program,
923+
Ancient distributions might not have the <command>sysctl</command> program,
918924
but equivalent changes can be made by manipulating the
919925
<filename>/proc</filename> file system:
920926
<screen>
921-
<prompt>$</prompt> <userinput>echo 134217728 &gt;/proc/sys/kernel/shmmax</userinput>
922-
<prompt>$</prompt> <userinput>echo 2097152 &gt;/proc/sys/kernel/shmall</userinput>
927+
<prompt>$</prompt> <userinput>echo 17179869184 &gt;/proc/sys/kernel/shmmax</userinput>
928+
<prompt>$</prompt> <userinput>echo 4194304 &gt;/proc/sys/kernel/shmall</userinput>
923929
</screen>
924930
</para>
931+
932+
<para>
933+
The remaining defaults are quite generously sized, and usually
934+
do not require changes.
935+
</para>
925936
</listitem>
926937
</varlistentry>
927938

0 commit comments

Comments
 (0)