Re: Big trouble with memory !!

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Hervé Piedvache <herve(at)elma(dot)fr>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Big trouble with memory !!
Date: 2005-04-06 15:08:31
Message-ID: 20050406150806.GD14589@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Costin Manda 2005-04-06 15:18:47 Re: very slow after a while...
Previous Message Richard Huxton 2005-04-06 15:03:18 Re: Big trouble with memory !!