Re: Big trouble with memory !! - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Big trouble with memory !!
Date
Msg-id 20050406150806.GD14589@svana.org
Whole thread Raw
In response to Big trouble with memory !!  (Hervé Piedvache <herve@elma.fr>)
Responses Re: Big trouble with memory !!  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Wed, Apr 06, 2005 at 04:35:43PM +0200, Hervé Piedvache wrote:
> Hi,
>
> We have switched to kernel 2.6.11.6 from kernel 2.4.26 ... since this date we
> have many troubles with PostgreSQL and most of them seems to be memory
> troubles.
>
> As far as we can see, kernel kills the postmaster process when it begins to
> use swap. You can see the output from dmesg at the bottom of the message.
> The first thing I am not sure to understand is that the kernel should kill
> processes to reallocate memory only when physical memory and swap memory are
> exhausted, shouldn't it ?
> Second thing: it seems to be related to our kernel switch as it did not happen
> before that.

My guess is that your problem stems from this line:

> vm.overcommit_memory=2

The code was changed so this *really* would not let anything exceed the
available memory. Instead of all shared pages for each library being
counted in common, each copy gets counted individually because each
process could possibly demand their own copy by writing to it.

This link seems to imply it was done in the 2.5 series.
http://kerneltrap.org/node/326

What I don't understand is that with true strict overcommit, the kernel
should never need to kill your process since there is always in
principle enough room. That worked, see:

> ERROR:  out of memory
> DETAIL:  Failed on request of size 24000.

Except the kernel killed it anyway, very odd. Which means someone isn't
counting properly. Your shared_buffers are on the high side, but that
may be the appropriate setting for your system...

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Big trouble with memory !!
Next
From: Costin Manda
Date:
Subject: Re: very slow after a while...