Re: icps, shmmax and shmall - Shared Memory tuning

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, dorian dorian <dorian37076(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: icps, shmmax and shmall - Shared Memory tuning
Date: 2002-04-29 09:12:55
Message-ID: 20020429191255.A13755@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Apr 29, 2002 at 04:38:17PM +0800, Lincoln Yeoh wrote:
> At 02:52 PM 4/29/02 +1000, Martijn van Oosterhout wrote:
> >I'm not saying it's a good idea. Indeed, people saying all the time it's
> >bad. But it is the default. If people don't like then they should set the
> >over_commit sysctl off (I forget the exact name).
>
> Can't find anything on it on the Linux doc site (tldp). Any links?

Somewhere in /proc. It's documented in the kernel source.

> Is it better to turn off overcommit and buy more RAM? That way postgresql
> or some other process doesn't get killed?

All turning off overcommit will do is cause your postgres to die with out of
memory earlier instead. Buying more memory is certainly an option. But it
would be better to work what is actually using the memory. Hypothetically,
if one of your users is DoSing your system, buying more memory won't help.

> All along I had the impression that Linux had big probs with its VM (since
> 2.x) with OOM situations (and not so good impressions of the people in
> charge of it), and so it's mainly because of overcommit? Ack.

No, it's mainly because people disagree what the system should do about it.
Overcommit means that people are allowed to allocate stuff without using it
and that's ok. For example, look at the following program:

while(1)
malloc(1024000);

With overcommit on, this program is harmless. The program will fill up it's
entire address space and stop. With overcommit off, every other program will
start getting out of memory errors. What is the solution here? Newer
versions of linux will kill a process like this, I don't know what other
OSes do.

Linux's VM problems are unrelated to this. They have to do with system
behaviour as sizeof(Working Set) approaches sizeof(Physical Memory). Bad is
if the machine continuously swaps, good if the machine stays reasonably
responsive. If you are experiencing this situation often, more memory is
necessary.

Hope this clears up any confusion,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Canada, Mexico, and Australia form the Axis of Nations That
> Are Actually Quite Nice But Secretly Have Nasty Thoughts About America

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message rich 2002-04-29 09:53:21 What popular, large commercial websites run PostgreSQL?
Previous Message Arsalan Zaidi 2002-04-29 09:04:04 Re: icps, shmmax and shmall - Shared Memory tuning