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

Commit ffce57d

Browse files
committed
Some editorializing on the Linux memory overcommit docs, from Neil Conway.
1 parent 51eba61 commit ffce57d

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

doc/src/sgml/runtime.sgml

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.218 2003/11/14 15:43:22 tgl Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.219 2003/11/16 03:38:34 tgl Exp $
33
-->
44

55
<Chapter Id="runtime">
@@ -1294,7 +1294,7 @@ SET ENABLE_SEQSCAN TO OFF;
12941294
<para>
12951295
Unfortunately, there is no well-defined method for determining
12961296
ideal values for the family of <quote>cost</quote> variables that
1297-
below. You are encouraged to experiment and share
1297+
appear below. You are encouraged to experiment and share
12981298
your findings.
12991299
</para>
13001300
</note>
@@ -3267,35 +3267,36 @@ default:\
32673267
<title>Linux Memory Overcommit</title>
32683268

32693269
<para>
3270-
Linux kernels of version 2.4.* have a poor default memory
3271-
overcommit behavior, which can result in the PostgreSQL server
3272-
(<filename>postmaster</filename> process) being killed by the
3273-
kernel if the memory demands of another process cause the system
3274-
to run out of memory.
3270+
In Linux 2.4, the default virtual memory behavior is not
3271+
optimal for <productname>PostgreSQL</productname>. Because of the
3272+
way that the kernel implements memory overcommit, the kernel may
3273+
terminate the <productname>PostgreSQL</productname> server (the
3274+
<filename>postmaster</filename> process) if the memory demands of
3275+
another process cause the system to run out of virtual memory.
32753276
</para>
32763277

32773278
<para>
3278-
If this happens, you will see a kernel message looking like this
3279-
(consult your system documentation and configuration on where to
3280-
look for such a message):
3279+
If this happens, you will see a kernel message that looks like
3280+
this (consult your system documentation and configuration on where
3281+
to look for such a message):
32813282
<programlisting>
32823283
Out of Memory: Killed process 12345 (postmaster).
32833284
</programlisting>
3284-
And, of course, you will find that your database server has
3285-
disappeared.
3285+
This indicates that the <filename>postmaster</filename> process
3286+
has been terminated due to memory pressure;
3287+
<productname>PostgreSQL</productname> will need to be restarted.
32863288
</para>
32873289

32883290
<para>
32893291
To avoid this situation, run <productname>PostgreSQL</productname>
32903292
on a machine where you can be sure that other processes will not
32913293
run the machine out of memory. If your kernel supports the strict
3292-
and/or paranoid modes of overcommit handling, you can also relieve
3293-
this problem by altering the system's default behaviour. This can
3294-
be determined by examining the function
3295-
<function>vm_enough_memory</> in the file <filename>mm/mmap.c</>
3296-
in the kernel source. If this file reveals that the strict and/or
3297-
paranoid modes are supported by your kernel, turn one of these
3298-
modes on by using
3294+
and/or paranoid modes of overcommit handling, you can also relieve this
3295+
problem by altering the system's default behaviour. This can be
3296+
determined by examining the function <function>vm_enough_memory</>
3297+
in the file <filename>mm/mmap.c</> in the kernel source. If this
3298+
file reveals that the strict or paranoid modes are supported by
3299+
your kernel, turn one of these modes on by using
32993300
<programlisting>
33003301
sysctl -w vm.overcommit_memory=2
33013302
</programlisting>
@@ -3304,28 +3305,29 @@ sysctl -w vm.overcommit_memory=2
33043305
sysctl -w vm.overcommit_memory=3
33053306
</programlisting>
33063307
for paranoid mode, or placing an equivalent entry in
3307-
<filename>/etc/sysctl.conf</>.
3308+
<filename>/etc/sysctl.conf</>. For more information on memory
3309+
overcommit handling and the meaning of these kernel settings,
3310+
consult the file
3311+
<filename>Documentation/vm/overcommit-accounting</filename> in a
3312+
recent version of the source code for the Linux kernel.
33083313
</para>
33093314

33103315
<caution>
33113316
<para>
3312-
Using these settings in a kernel which does not support these
3317+
Using these settings with a kernel which does not support these
33133318
modes will almost certainly increase the danger of the kernel
33143319
killing the database server, rather than reducing it. If in any
33153320
doubt, consult a kernel expert or your kernel vendor.
33163321
</para>
33173322
</caution>
33183323

33193324
<para>
3320-
These modes are expected to be supported in all 2.6 and later
3321-
kernels. Some vendor 2.4 kernels may also support these modes. It
3322-
is, however, known that some vendor documents suggest that they
3323-
support them while examination of the kernel source reveals that
3324-
they do not.
3325-
</para>
3326-
3327-
<para>
3328-
Note, you will need enough swap space to cover all your memory needs.
3325+
The method described above for changing the kernel's overcommit
3326+
behavior should work with Linux kernel versions 2.6 and later. In addition,
3327+
some versions of the 2.4 kernel distributed by some vendors may
3328+
also support this functionality. However, it is known that some
3329+
vendor documents suggest that they support them while examination
3330+
of the kernel source reveals that they do not.
33293331
</para>
33303332
</sect2>
33313333
</sect1>

0 commit comments

Comments
 (0)