Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] bgwriter_lru_multiplier blurbs inconsistent

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 (view raw or flat)
Thread:
Lists: pgsql-docspgsql-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

In response to

Responses

pgsql-docs by date

Next:From: Tom LaneDate: 2008-01-20 22:05:22
Subject: Re: [HACKERS] bgwriter_lru_multiplier blurbs inconsistent
Previous:From: Tom LaneDate: 2008-01-20 20:08:40
Subject: Re: bgwriter_lru_multiplier blurbs inconsistent

pgsql-hackers by date

Next:From: Mark Cave-AylandDate: 2008-01-20 21:12:32
Subject: Minor bug in src/port/rint.c
Previous:From: Ivan Sergio BorgonovoDate: 2008-01-20 20:51:07
Subject: setof record "out" syntax and returning records

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group