Re: [performance] fast reads on a busy server

From: Willy-Bas Loos <willybas(at)gmail(dot)com>
To: Hannu Krosing <hannu(at)2ndquadrant(dot)com>
Cc: pgsql-cluster-hackers(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org, Greg Smith <greg(at)2ndquadrant(dot)com>
Subject: Re: [performance] fast reads on a busy server
Date: 2012-06-27 10:01:51
Message-ID: CAHnozTgNQD=eoWV_3Zy5BOXwZrO+qAym8kOA0-XBEJRMrEk0wg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cluster-hackers pgsql-performance

On Wed, Jun 27, 2012 at 9:34 AM, Hannu Krosing <hannu(at)2ndquadrant(dot)com>wrote:

> Check if you are CPU-bound. On a database which fits fully you may
> already be.
>
> Being CPU-bound is my goal.
That makes your answer a yes to me.

Only i'm afraid that this solution is not optimal.
Because i am stealing more resopurces from the (already busy) rest of the
server than necessary. That's because the file-cache will also be filled
(partially) with data that this cluster uses, unnecessarily. I'm not going
to read from the file cache, because the data will be in the shared_buffers
as soon as they have been read from disk.

So then, would it be better to use 80% of memory for the shared buffers of
the combined clusters?
I've read that 25% is good and 40% is max because of the file cache, but it
doesn't make much sense..

Greg Smith writes
(here<http://www.westnet.com/%7Egsmith/content/postgresql/InsideBufferCache.pdf>,
page 12):
* PostgreSQL is designed to rely heavily on the operating
system cache, because portable sotware like PostgreSQL can’t
know enough about the filesystem or disk layout to make
optimal decisions about how to read and write files
* The shared buffer cache is really duplicating what the
operating system is already doing: caching popular file blocks
* In many cases, you’ll find exactly the same blocks cached by
both the buffer cache and the OS page cache
* This makes is a bad idea to give PostgreSQL too much
memory to manage

I cannot follow that reasoning completely. Who needs OS level file cache
when postgres' shared_buffers is better? The efficiency should go up again
after passing 50% of shared buffers, where you would be caching everything
twice.
The only problem i see is that work_mem and such will end up in SWAP if
there isn't enough memory left over to allocate.

Cheers,

WBL

--
"Quality comes from focus and clarity of purpose" -- Mark Shuttleworth

In response to

Responses

Browse pgsql-cluster-hackers by date

  From Date Subject
Next Message Willy-Bas Loos 2012-06-27 11:28:39 Re: [performance] fast reads on a busy server
Previous Message Hannu Krosing 2012-06-27 07:34:16 Re: [performance] fast reads on a busy server

Browse pgsql-performance by date

  From Date Subject
Next Message Willy-Bas Loos 2012-06-27 11:28:39 Re: [performance] fast reads on a busy server
Previous Message Hannu Krosing 2012-06-27 07:34:16 Re: [performance] fast reads on a busy server