Re: Shared Memory Sizing

From: "Glen Parker" <glenebob(at)nwlink(dot)com>
To: "Pg-General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Shared Memory Sizing
Date: 2002-06-27 20:44:56
Message-ID: 008101c21e1b$80bb3d20$0b01a8c0@johnpark.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I guess I'll add my 2cents here... I run a Linux/Postgres server with
1GB of ram, and give postgres 48049 shared buffers. This lets the
backends top out around 400MB each when they really get going.

The effect I've seen is that more buffers don't hurt. However, adding
more buffers stops making a significant difference at some low number
that is a small fraction of what I use (and would obviously depend
heavily on usage). Now assuming that the server is dedicated to
postgres (which mine is), I can't see any reason not to give almost all
available physical memory to postgres. The whole point of the OS disk
caching is for *shared* caching, so if only one application is using the
majority of the disk cache, what does it hurt to just let that
application have it all as private memory? If there were no cost
associated with copying pages from OS cache to user land, then I'd say
it makes more sense to give almost no memory to the postgres cache, but
obviously there is a cost; the more often postgres has to ask the OS for
a page, the worse performance will be. The more memory you give to
postgres, the more often asking the OS for a page will result in a disk
read. It seems optimal to me to *never* ask the OS for a page unless it
has to be pulled from the disk.

Obviously a lot of people disagree with this... I'd like to understand
why this approach is considered incorrect when postgres rather owns the
machine?

Glen Parker
glenebob(at)nwlink(dot)com

>
> Curt Sampson wrote:
> >
> > Just going back through old mail, I notice this. So I'm not
> the only one
> > with this opinion. I've seen, at least twice in the last week or so,
> > people make the mistake of devoting about half their memory
> to postgres
> > shared memory buffers (the wost thing you can do!). Would
> someone care
> > to go around and find all the spots that talk about this
> and update them
> > to have more reasonable advice?
>
> I advise in my hardware tuning guide that it be increased until paging
> starts, then reduce it, and start around 25%. Is that OK?
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
> + If your life is a hard drive, | 830 Blythe Avenue
> + Christ can be your backup. | Drexel Hill,
> Pennsylvania 19026
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
http://www.postgresql.org/users-lounge/docs/faq.html

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2002-06-27 20:59:20 Re: Shared Memory Sizing
Previous Message Jon Lapham 2002-06-27 19:31:14 Wildcards in GROUP BY?