Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdFs3-0001GR-AJ for pgsql-docs@arkaria.postgresql.org; Thu, 12 Nov 2020 16:54:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kdFrV-0003vC-Dc for pgsql-docs@arkaria.postgresql.org; Thu, 12 Nov 2020 16:54:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdFrV-0003v5-7w for pgsql-docs@lists.postgresql.org; Thu, 12 Nov 2020 16:54:17 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdFrS-0002qq-Lm for pgsql-docs@lists.postgresql.org; Thu, 12 Nov 2020 16:54:16 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1kdFrQ-0000JE-J7; Thu, 12 Nov 2020 11:54:12 -0500 Date: Thu, 12 Nov 2020 11:54:12 -0500 From: Bruce Momjian To: Chris Wilson Cc: Thomas Munro , Pg Docs Subject: Re: What does "[backends] should seldom or never need to wait for a write to occur" mean? Message-ID: <20201112165412.GC25584@momjian.us> References: <160399562040.7809.7335281028960123489@wrigleys.postgresql.org> <20201110013632.GA8789@momjian.us> <20201110160801.GA25651@momjian.us> <20201111232417.GH25840@momjian.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="+HP7ph2BbKc20aGI" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Thu, Nov 12, 2020 at 02:40:04PM +0000, Chris Wilson wrote: > Hi Bruce, > > Thanks, yes I agree that that is much clearer. However when you say: > > > When the percentage of dirty shared buffers is high, the background writer > writes some of them to the file system... > > > I haven't seen anything about a minimum percentage before the bgwriter kicks > in, is that really the case? How is it configured? Yes, I see your point. My language was not accurate, and it didn't match the actual background writer tuning parameters below this text. Here is an updated doc patch. I agree this text should be as clear as possible because there is no way to properly tune the background writer parameters unless we explain how it works. It is good you noticed this. -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee --+HP7ph2BbKc20aGI Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="bgwriter.diff" diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index f043433e31..8a29c90fdc 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -2146,8 +2146,11 @@ include_dir 'conf.d' There is a separate server process called the background writer, whose function is to issue writes of dirty (new or modified) shared - buffers. It writes shared buffers so server processes handling - user queries seldom or never need to wait for a write to occur. + buffers. When the number of non-dirty shared buffers appears to be + insufficient, the background writer writes some dirty buffers to the + file system and marks them as clean. This reduces the likelihood + that server processes handling user queries will be unable to find + clean buffers and have to write dirty buffers themselves. However, the background writer does cause a net overall increase in I/O load, because while a repeatedly-dirtied page might otherwise be written only once per checkpoint interval, the --+HP7ph2BbKc20aGI--