Re: Background writer process - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Background writer process
Date
Msg-id 200311132239.hADMdWj29089@candle.pha.pa.us
Whole thread Raw
In response to Re: Background writer process  (Jan Wieck <JanWieck@Yahoo.com>)
Responses Re: Background writer process
List pgsql-hackers
Jan Wieck wrote:
> Bruce Momjian wrote:
> 
> > Kurt Roeckx wrote:
> >> On Thu, Nov 13, 2003 at 04:35:31PM -0500, Jan Wieck wrote:
> >> > For sure the sync() needs to be replaced by the discussed fsync() of 
> >> > recently written files. And I think the algorithm how much and how often 
> >> > to flush can be significantly improved. But after all, this does not 
> >> > change the real checkpointing at all, and the general framework having a 
> >> > separate process is what we probably want.
> >> 
> >> Why is the sync() needed at all?  My understanding was that it
> >> was only needed in case of a checkpoint.
> > 
> > He found that write() itself didn't encourage the kernel to write the
> > buffers to disk fast enough.  I think the final solution will be to use
> > fsync or O_SYNC.
> > 
> 
> write() alone doesn't encourage the kernel to do any physical IO at all. 
> As long as you have enough OS buffers, it does happy write caching until 
> you checkpoint and sync(), and then the system freezes.

That's not completely true.  Some kernels with trickle sync, meaning
they sync a little bit regularly rather than all at once so write() does
help get those shared buffers into the kernel for possible writing. 
Also, it is possible the kernel will issue a sync() on its own.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Jan Wieck
Date:
Subject: Re: Background writer process
Next
From: Kurt Roeckx
Date:
Subject: Re: Background writer process