Re: [HACKERS] bgwriter_lru_multiplier blurbs inconsistent

Lists: pgsql-docspgsql-hackers
From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: pgsql-docs(at)postgresql(dot)org
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: bgwriter_lru_multiplier blurbs inconsistent
Date: 2008-01-20 19:55:19
Message-ID: 20080120195519.GD22740@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-docs pgsql-hackers

Is the bgwriter_lru_multiplier parameter a limit on the number to scan
or to write? GUC and docs seem to contradict one another. GUC says

#: utils/misc/guc.c:1834
#, fuzzy
msgid "Background writer multiplier on average buffers to scan per round."

The docs say

Unless limited by <varname>bgwriter_lru_maxpages</>, the number
of dirty buffers written in each round is determined by reference
to the number of new buffers that have been needed by server
processes during recent rounds. This number is multiplied by
<varname>bgwriter_lru_multiplier</> to arrive at the estimate
of the number of buffers that will be needed during the next round.

Which one is correct? Do we need a correction of either?

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: pgsql-docs(at)postgresql(dot)org, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bgwriter_lru_multiplier blurbs inconsistent
Date: 2008-01-20 20:08:40
Message-ID: 11682.1200859720@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-docs pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Is the bgwriter_lru_multiplier parameter a limit on the number to scan
> or to write? GUC and docs seem to contradict one another. GUC says

> #: utils/misc/guc.c:1834
> #, fuzzy
> msgid "Background writer multiplier on average buffers to scan per round."

> The docs say
> Unless limited by <varname>bgwriter_lru_maxpages</>, the number
> of dirty buffers written in each round is determined by reference
> to the number of new buffers that have been needed by server
> processes during recent rounds. This number is multiplied by
> <varname>bgwriter_lru_multiplier</> to arrive at the estimate
> of the number of buffers that will be needed during the next round.

> Which one is correct? Do we need a correction of either?

We multiply the average number of new buffers used per round by the
multiplier, and use that as the target for the number of clean buffers
to have in front of the sweep hand. Any of these that are dirty will
be written (until we exceed maxpages written). So it's the number to scan.

I don't find either the docs or the msgid to be wrong, exactly; but if
you have a proposal for better wording, I'm all ears.

regards, tom lane


From: Greg Smith <gsmith(at)gregsmith(dot)com>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: pgsql-docs(at)postgresql(dot)org, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] bgwriter_lru_multiplier blurbs inconsistent
Date: 2008-01-20 20:55:54
Message-ID: Pine.GSO.4.64.0801201505250.17332@westnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-docs pgsql-hackers

On Sun, 20 Jan 2008, Alvaro Herrera wrote:

> Is the bgwriter_lru_multiplier parameter a limit on the number to scan
> or to write? GUC and docs seem to contradict one another.

It adjusts the target for how many clean buffers it wants to either find
or create. This always increases the number of buffers scanned, and
that's what the GUC description says.

Since a clean buffer can either be a) a reusable candidate found by
scanning or b) a buffer that is written, on average it's adjusting up the
number of writes as well. But it's not guaranteed to--you could have a
case where it just found all the buffers it needed and never wrote a
single one.

> Unless limited by <varname>bgwriter_lru_maxpages</>, the number
> of dirty buffers written in each round is determined by reference
> to the number of new buffers that have been needed by server
> processes during recent rounds. This number is multiplied by
> <varname>bgwriter_lru_multiplier</> to arrive at the estimate
> of the number of buffers that will be needed during the next round.

There is nothing incorrect here, it's just not as clear as it could be.
Here's a V2 that tries to clear that up:

Unless limited by <varname>bgwriter_lru_maxpages</>, the number of dirty
buffers written in each round is based on the number of new buffers that
have been needed by server processes during recent rounds. The recent
need is multiplied by <varname>bgwriter_lru_multiplier</> to arrive at the
estimate of the number of buffers that will be needed during the next
round. Buffers are written to meet that need if there aren't enough
reusable ones found while scanning.

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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Smith <gsmith(at)gregsmith(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-docs(at)postgresql(dot)org, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] bgwriter_lru_multiplier blurbs inconsistent
Date: 2008-01-20 22:05:22
Message-ID: 13942.1200866722@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-docs pgsql-hackers

Greg Smith <gsmith(at)gregsmith(dot)com> writes:
> There is nothing incorrect here, it's just not as clear as it could be.
> Here's a V2 that tries to clear that up:

> Unless limited by <varname>bgwriter_lru_maxpages</>, the number of dirty
> buffers written in each round is based on the number of new buffers that
> have been needed by server processes during recent rounds. The recent
> need is multiplied by <varname>bgwriter_lru_multiplier</> to arrive at the
> estimate of the number of buffers that will be needed during the next
> round. Buffers are written to meet that need if there aren't enough
> reusable ones found while scanning.

I think the main problem is the qualifying clause up front in a place
of prominence. Here's a V3 try:

The number of dirty buffers written in each round is based on the number
of new buffers that have been needed by server processes during recent
rounds. The average recent need is multiplied by
<varname>bgwriter_lru_multiplier</> to arrive at the estimate of the
number of buffers that will be needed during the next round. Dirty
buffers are written until there are that many clean, reusable buffers
available. However, no more than <varname>bgwriter_lru_maxpages</>
buffers will be written per round.

regards, tom lane


From: Greg Smith <gsmith(at)gregsmith(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-docs(at)postgresql(dot)org, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] bgwriter_lru_multiplier blurbs inconsistent
Date: 2008-01-21 03:07:52
Message-ID: Pine.GSO.4.64.0801202206320.29293@westnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-docs pgsql-hackers

On Sun, 20 Jan 2008, Tom Lane wrote:

> I think the main problem is the qualifying clause up front in a place
> of prominence. Here's a V3 try

That one looks good to me. These are small details but better to get it
right now.

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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Smith <gsmith(at)gregsmith(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-docs(at)postgresql(dot)org, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] bgwriter_lru_multiplier blurbs inconsistent
Date: 2008-01-21 03:29:48
Message-ID: 19882.1200886188@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-docs pgsql-hackers

Greg Smith <gsmith(at)gregsmith(dot)com> writes:
> On Sun, 20 Jan 2008, Tom Lane wrote:
>> I think the main problem is the qualifying clause up front in a place
>> of prominence. Here's a V3 try

> That one looks good to me. These are small details but better to get it
> right now.

OK, committed. Back to Alvaro's original concern: is the short
description in guc.c all right, or can we improve that?

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Smith <gsmith(at)gregsmith(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-docs(at)postgresql(dot)org, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] bgwriter_lru_multiplier blurbs inconsistent
Date: 2008-03-06 16:32:03
Message-ID: 200803061632.m26GW3L04395@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-docs pgsql-hackers

Tom Lane wrote:
> Greg Smith <gsmith(at)gregsmith(dot)com> writes:
> > On Sun, 20 Jan 2008, Tom Lane wrote:
> >> I think the main problem is the qualifying clause up front in a place
> >> of prominence. Here's a V3 try
>
> > That one looks good to me. These are small details but better to get it
> > right now.
>
> OK, committed. Back to Alvaro's original concern: is the short
> description in guc.c all right, or can we improve that?

I have tried to improve the GUC description for
"bgwriter_lru_multiplier"; applied to CVS HEAD.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
/rtmp/diff text/x-diff 777 bytes