Re: Shared Memory Sizing

From: Curt Sampson <cjs(at)cynic(dot)net>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Doug Fields <dfields-pg-general(at)pexicom(dot)com>, "Peter A(dot) Daly" <petedaly(at)ix(dot)netcom(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Shared Memory Sizing
Date: 2002-06-27 03:53:29
Message-ID: Pine.NEB.4.43.0206271241300.6613-100000@angelic.cynic.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)cynic(dot)net> +81 90 7737 2974 http://www.netbsd.org
Don't you know, in this new Dark Age, we're all light. --XTC

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nadim Bitar 2002-06-27 03:56:11 Large Objects
Previous Message Christopher Kings-Lynne 2002-06-27 03:48:10 Re: (A) native Windows port