Re: Shared Memory Sizing - Mailing list pgsql-general

From Curt Sampson
Subject Re: Shared Memory Sizing
Date
Msg-id Pine.NEB.4.43.0206271241300.6613-100000@angelic.cynic.net
Whole thread Raw
In response to Re: Shared Memory Sizing  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-general
On Wed, 26 Jun 2002, Bruce Momjian wrote:

> I advise in my hardware tuning guide that it be increased until paging
> starts, then reduce it, and start around 25%.  Is that OK?

I don't think that's optimal. The general gist is that if the OS
has as much free memory as postgres has shared memory used for
buffering, it's going to be buffering pretty much all the data that
posgres is. So every block that postgres holds is using 8K of memory
that the OS could use to cache a different block.

Now it's a bit more subtle than this in that copying a buffer
between postgres's shared memory and OS memory also has a cost,
and we should try to minimize that. But still, that's a lot cheaper
than moving a buffer between memory and disk.

This sort of thing is one of the main reasons I like the idea of
moving to mmap for data files; it gets rid of both the double
buffering and the copying back-and-forth. (And even if you do end
up copying, you still save the kernel/userland transition, which
is also a little bit expensive.)

cjs
--
Curt Sampson  <cjs@cynic.net>   +81 90 7737 2974   http://www.netbsd.org
    Don't you know, in this new Dark Age, we're all light.  --XTC




pgsql-general by date:

Previous
From: Christopher Murtagh
Date:
Subject: Re: Postgresql can handle 200 connections (two tier) ?
Next
From: Nadim Bitar
Date:
Subject: Large Objects