Re: lowering impact of checkpoints

From: Greg Smith <gsmith(at)gregsmith(dot)com>
To: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: lowering impact of checkpoints
Date: 2007-09-25 16:34:02
Message-ID: Pine.GSO.4.64.0709251209310.16834@westnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 25 Sep 2007, hubert depesz lubaczewski wrote:

> name | setting | unit
> -----------------------+-----------+--------
> bgwriter_all_maxpages | 5 |
> bgwriter_all_percent | 0.333 | [null]
> bgwriter_delay | 200 | ms
> bgwriter_lru_maxpages | 5 |
> bgwriter_lru_percent | 1 | [null]

The background writer can help smooth out checkpoints a bit in 8.2.4, but
these settings are barely doing anything; they aren't even in the right
ballpark for a system that's doing 600-2000 TPS. You need to be careful
here because making the background writer run too often can result in
things running slower all the time, and in some cases it can even make the
checkpoints worse.

I would suggest changing these parameters one at a time, in the following
order, and see what happens to the number of slow queries at checkpoint
time after each change:

bgwriter_lru_maxpages: increase to 500
bgwriter_lru_percent: increase to 5
bgwriter_all_maxpage: increase to 250
bgwriter_all_percent: increase to 2

If these are all positive changes, you might even want to increase these
further; potentially you could double all of the above and still not have
the settings high enough, and if that's the case you may have to adjust
bgwriter_delay downward. Here is a message I'd suggest reading carefully
from someone who went through the process you're starting now and ended up
with a much more aggressive set of settings even than these:

http://archives.postgresql.org/pgsql-hackers/2006-12/msg00383.php

As Kevin suggests there, one thing that varies a bit based on the exact
work you're doing is the ratio between how heavily you balance the all vs.
lru weighting. His final settings use the all writer a bit more heavily
than I'd normally recommend, but with his particular system that worked
out well.

--
* Greg Smith gsmith(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Siebert 2007-09-25 16:39:02 Yum Repository for Postgres 8.2.5
Previous Message Dan99 2007-09-25 16:01:18 Re: PG_DUMP not working