Re: Shared Memory Sizing - Mailing list pgsql-general

From Glen Parker
Subject Re: Shared Memory Sizing
Date
Msg-id 008101c21e1b$80bb3d20$0b01a8c0@johnpark.net
Whole thread Raw
In response to Re: Shared Memory Sizing  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Shared Memory Sizing  (Andrew Sullivan <andrew@libertyrms.info>)
List 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@nwlink.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@candle.pha.pa.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





pgsql-general by date:

Previous
From: Jon Lapham
Date:
Subject: Wildcards in GROUP BY?
Next
From: Andrew Sullivan
Date:
Subject: Re: Shared Memory Sizing