Re: Controlling Load Distributed Checkpoints

From: Greg Smith <gsmith(at)gregsmith(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Controlling Load Distributed Checkpoints
Date: 2007-06-06 18:26:11
Message-ID: Pine.GSO.4.64.0706061409050.27416@westnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Wed, 6 Jun 2007, Heikki Linnakangas wrote:

> The original patch uses bgwriter_all_max_pages to set the minimum rate. I
> think we should have a separate variable, checkpoint_write_min_rate, in KB/s,
> instead.

Completely agreed. There shouldn't be any coupling with the background
writer parameters, which may be set for a completely different set of
priorities than the checkpoint has. I have to look at this code again to
see why it's a min_rate instead of a max, that seems a little weird.

> Nap phase: We should therefore give the delay as a number of seconds
> instead of as a percentage of checkpoint interval.

Again, the setting here should be completely decoupled from another GUC
like the interval. My main complaint with the original form of this patch
was how much it tried to syncronize the process with the interval; since I
don't even have a system where that value is set to something, because
it's all segment based instead, that whole idea was incompatible.

The original patch tried to spread the load out as evenly as possible over
the time available. I much prefer thinking in terms of getting it done as
quickly as possible while trying to bound the I/O storm.

> And we don't know how much work an fsync performs. The patch uses the file
> size as a measure of that, but as we discussed that doesn't necessarily have
> anything to do with reality. fsyncing a 1GB file with one dirty block isn't
> any more expensive than fsyncing a file with a single block.

On top of that, if you have a system with a write cache, the time an fsync
takes can greatly depend on how full it is at the time, which there is no
way to measure or even model easily.

Is there any way to track how many dirty blocks went into each file during
the checkpoint write? That's your best bet for guessing how long the
fsync will take.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2007-06-06 18:27:29 Re: elog.c logic bug?
Previous Message Jeff Davis 2007-06-06 18:24:41 Re: [RFC] GSoC Work on readonly queries done so far

Browse pgsql-patches by date

  From Date Subject
Next Message Hannes Eder 2007-06-06 19:12:53 Re: msvc, build and install with cygwin in the PATH
Previous Message Greg Smith 2007-06-06 18:05:35 Re: Controlling Load Distributed Checkpoints