Commit b0ba70df authored by Bruce Momjian's avatar Bruce Momjian

Update information about Linux's overcommit memory behavior.

Andrew Dunstan
parent 5b49f902
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.201 2003/08/31 17:32:19 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.202 2003/09/05 02:54:09 momjian Exp $
--> -->
<Chapter Id="runtime"> <Chapter Id="runtime">
...@@ -3081,14 +3081,61 @@ kernel.shmmax = 134217728 ...@@ -3081,14 +3081,61 @@ kernel.shmmax = 134217728
</para> </para>
<para> <para>
Linux has poor default memory overcommit behavior. Rather than Linux kernel version 2.4.* has poor default memory overcommit
failing if it can not reserve enough memory, it returns success, behavior, which can result in the postmaster being killed by the
but later fails when the memory can't be mapped and terminates kernel due to memory demands by another process if the system
the application with <literal>kill -9</>. To prevent unpredictable runs out of memory.
process termination, use: </para>
<para>
The symptom of this occuring is a kernel message looking like
this (consult your system documentation and configuration on
where to look for such a message):
<programlisting>
Out of Memory: Killed process 12345 (postmaster).
</programlisting>
</para>
<para>
To avoid this situation, run <productname>PostgreSQL</productname>
on a machine where you
can be sure that other processes will not run the machine out
of memory. If your kernel supports strict and/or paranoid modes
of overcommit handling, you can also relieve this problem by
altering the system's default behaviour. This can be determined
by examining the function <function>vm_enough_memory</>
in the file <filename>mm/mmap.c</>in the kernel source.
If this file reveals that strict and/or paranoid modes are
supported by your kernel, turn one of these modes on by using
<programlisting>
sysctl -w vm.overcommit_memory=2
</programlisting>
for strict mode or
<programlisting> <programlisting>
sysctl -w vm.overcommit_memory=3 sysctl -w vm.overcommit_memory=3
</programlisting> </programlisting>
for paranoid mode, or placing an equivalent entry in
<filename>/etc/sysctl.conf</>.
</para>
<note>
<para>
Warning: using these settings in a kernel which does not support
these modes will almost certainly increase the danger of the
kernel killing the postmaster, rather than reducing it.
If in any doubt, consult a kernel expert or your kernel vendor.
</para>
</note>
<para>
These modes are expected to be supported in all 2.6 and later
kernels. Some vendor 2.4 kernels may also support these modes.
However, it is known that some vendor documents suggest that
they support them while examination of the kernel source reveals
that they do not.
</para>
<para>
Note, you will need enough swap space to cover all your memory needs. Note, you will need enough swap space to cover all your memory needs.
</para> </para>
</listitem> </listitem>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment