11<!--
2- $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.220 2003/11/1603:58:10 tgl Exp $
2+ $Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.221 2003/11/1617:01:50 tgl Exp $
33-->
44
55<Chapter Id="runtime">
@@ -3269,7 +3269,7 @@ default:\
32693269 <title>Linux Memory Overcommit</title>
32703270
32713271 <para>
3272- In Linux 2.4, the default virtual memory behavior is not
3272+ In Linux 2.4 and later , the default virtual memory behavior is not
32733273 optimal for <productname>PostgreSQL</productname>. Because of the
32743274 way that the kernel implements memory overcommit, the kernel may
32753275 terminate the <productname>PostgreSQL</productname> server (the
@@ -3285,51 +3285,45 @@ default:\
32853285Out of Memory: Killed process 12345 (postmaster).
32863286</programlisting>
32873287 This indicates that the <filename>postmaster</filename> process
3288- has been terminated due to memory pressure;
3288+ has been terminated due to memory pressure.
3289+ Although existing database connections will continue to function
3290+ normally, no new connections will be accepted. To recover,
32893291 <productname>PostgreSQL</productname> will need to be restarted.
32903292 </para>
32913293
32923294 <para>
3293- To avoid this situation, run <productname>PostgreSQL</productname>
3295+ One way to avoid this problem is to run
3296+ <productname>PostgreSQL</productname>
32943297 on a machine where you can be sure that other processes will not
3295- run the machine out of memory. If your kernel supports the strict
3296- and/or paranoid modes of overcommit handling, you can also relieve this
3297- problem by altering the system's default behaviour. This can be
3298- determined by examining the function <function>vm_enough_memory</ >
3299- in the file <filename>mm/mmap.c</> in the kernel source. If this
3300- file reveals thatthe strict or paranoid modes are supported by
3301- your kernel, turn one of these modes on by using
3298+ run the machine out of memory.
3299+ </para>
3300+
3301+ <para >
3302+ On Linux 2.6 and later, a better solution is to modify the kernel's
3303+ behavior so thatit will not <quote>overcommit</> memory. This is
3304+ done by selecting strict overcommit mode via sysctl:
33023305<programlisting>
33033306sysctl -w vm.overcommit_memory=2
33043307</programlisting>
3305- for strict mode, or
3306- <programlisting>
3307- sysctl -w vm.overcommit_memory=3
3308- </programlisting>
3309- for paranoid mode, or placing an equivalent entry in
3310- <filename>/etc/sysctl.conf</>. For more information on memory
3311- overcommit handling and the meaning of these kernel settings,
3312- consult the file
3313- <filename>Documentation/vm/overcommit-accounting</filename> in a
3314- recent version of the source code for the Linux kernel.
3308+ or placing an equivalent entry in <filename>/etc/sysctl.conf</>.
3309+ You may also wish to modify the related setting
3310+ <literal>vm.overcommit_ratio</>. For details see the kernel documentation
3311+ file <filename>Documentation/vm/overcommit-accounting</>.
33153312 </para>
33163313
3317- <caution>
3318- <para>
3319- Using these settings with a kernel which does not support these
3320- modes will almost certainly increase the danger of the kernel
3321- killing the database server, rather than reducing it. If in any
3322- doubt, consult a kernel expert or your kernel vendor.
3323- </para>
3324- </caution>
3325-
33263314 <para>
3327- The method described above for changing the kernel's overcommit
3328- behavior should work with Linux kernel versions 2.6 and later. In addition,
3329- some versions of the 2.4 kernel distributed by some vendors may
3330- also support this functionality. However, it is known that some
3331- vendor documents suggest that they support them while examination
3332- of the kernel source reveals that they do not.
3315+ Some vendors' Linux 2.4 kernels are reported to have early versions
3316+ of the 2.6 overcommit sysctl. However, setting
3317+ <literal>vm.overcommit_memory</> to 2
3318+ on a kernel that does not have the relevant code will make
3319+ things worse not better. It is recommended that you inspect
3320+ the actual kernel source code (see the function
3321+ <function>vm_enough_memory</> in the file <filename>mm/mmap.c</>)
3322+ to verify what is supported in your copy before you try this in a 2.4
3323+ installation. The presence of the <filename>overcommit-accounting</>
3324+ documentation file should <emphasis>not</> be taken as evidence that the
3325+ feature is there. If in any doubt, consult a kernel expert or your
3326+ kernel vendor.
33333327 </para>
33343328 </sect2>
33353329 </sect1>