X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8EAC2D1D885 for ; Thu, 5 Feb 2004 15:11:02 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 23189-04 for ; Thu, 5 Feb 2004 11:11:07 -0400 (AST) Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [192.108.102.143]) by svr1.postgresql.org (Postfix) with ESMTP id D1B64D1D55F for ; Thu, 5 Feb 2004 11:10:56 -0400 (AST) Received: from ps0499.intranet.pspl.co.in shridhar_daithankar@smtp-send.myrealbox.com [202.54.11.72] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 3.56 $ on Novell NetWare via secured & encrypted transport (TLS); Thu, 05 Feb 2004 08:11:05 -0700 From: Shridhar Daithankar Reply-To: shridhar@frodo.hserus.net To: "PostgreSQL-development" Subject: Re: [pgsql-hackers-win32] Sync vs. fsync during checkpoint Date: Thu, 5 Feb 2004 20:45:48 +0530 User-Agent: KMail/1.6 References: <46C15C39FEB2C44BA555E356FBCD6FA49620A3@m0114.s-mxs.net> <2297.1075992889@sss.pgh.pa.us> In-Reply-To: <2297.1075992889@sss.pgh.pa.us> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200402052045.48448.shridhar@frodo.hserus.net> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/185 X-Sequence-Number: 49774 On Thursday 05 February 2004 20:24, Tom Lane wrote: > "Zeugswetter Andreas SB SD" writes: > > So Imho the target should be to have not much IO open for the checkpoint, > > so the fsync is fast enough, even if serial. > > The best we can do is push out dirty pages with write() via the bgwriter > and hope that the kernel will see fit to write them before checkpoint > time arrives. I am not sure if that hope has basis in fact or if it's > just wishful thinking. Most likely, if it does have basis in fact it's > because there is a standard syncer daemon forcing a sync() every thirty > seconds. There are other benefits of writing pages earlier even though they might not get synced immediately. It would tell kernel that this is latest copy of updated buffer. Kernel VFS should make that copy visible to every other backend as well. The buffer manager will fetch the updated copy from VFS cache next time. All without going to disk actually..(Within the 30 seconds window of course..) > People keep saying that the bgwriter mustn't write pages synchronously > because it'd be bad for performance, but I think that analysis is > faulty. Performance of what --- the bgwriter? Nonsense, the *point* > of the bgwriter is to do the slow tasks. The only argument that has > any merit is that O_SYNC or immediate fsync will prevent us from having > multiple writes outstanding and thus reduce the efficiency of disk > write scheduling. This is a valid point but there is a limit to how > many writes we need to have in flight to keep things flowing smoothly. Is it a valid assumption for platforms-that-postgresql-supports that a write call would make changes visible across processes? > > What I'm thinking now is that the bgwriter should issue frequent fsyncs > for its writes --- not immediate, but a lot more often than once per frequent fsyncs or frequent fsyncs per file descriptor written? I thought it was later. Just a thought. Shridhar