Re: [pgsql-hackers-win32] fsync with sync, and Win32 unlink

Lists: pgsql-hackerspgsql-hackers-win32
From: "Zeugswetter Andreas SB SD" <ZeugswetterA(at)spardat(dot)at>
To: "Magnus Hagander" <mha(at)sollentuna(dot)net>, "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>, "PostgreSQL-development" <pgsql-hackers(at)postgreSQL(dot)org>
Cc: "PostgreSQL Win32 port list" <pgsql-hackers-win32(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] fsync with sync, and Win32 unlink
Date: 2004-03-11 09:38:40
Message-ID: 46C15C39FEB2C44BA555E356FBCD6FA40184D019@m0114.s-mxs.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-hackers-win32


> Consider either a box with many different postgresql instances, or one
> that run both postgresql and other software. Issuing sync() in that
> sitaution will cause sync of a lot of data that probably doesn't need
> syncing.
> But it'd probably be a very good thing on a dedicated server, giving the
> kernel the chance to optimise.

It is not like the sync is done every few seconds ! It is currently done
every 5 minutes (I actually think this is too frequent now that we have
bgwriter, 10 - 20 min would be sufficient). So imho even on a heavily
otherwise used system the sync will be better.

Andreas


From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [pgsql-hackers-win32] fsync with sync, and Win32 unlink
Date: 2004-03-11 17:51:09
Message-ID: 874qsv6zn6.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-hackers-win32


"Zeugswetter Andreas SB SD" <ZeugswetterA(at)spardat(dot)at> writes:

> > Consider either a box with many different postgresql instances, or one
> > that run both postgresql and other software. Issuing sync() in that
> > sitaution will cause sync of a lot of data that probably doesn't need
> > syncing.
> > But it'd probably be a very good thing on a dedicated server, giving the
> > kernel the chance to optimise.
>
> It is not like the sync is done every few seconds ! It is currently done
> every 5 minutes (I actually think this is too frequent now that we have
> bgwriter, 10 - 20 min would be sufficient). So imho even on a heavily
> otherwise used system the sync will be better.

Well, the further apart it is the more dangerous it is to be calling sync...

I've seen some pretty severe damage caused by calling sync(2) on a loaded
system. The system in question was in the process of copying data to an NFS
mounted archival site. When the sync hit basically everything stopped until
the buffered network writes could be synced. The live database was basically
frozen for a few seconds and the web site nearly crashed. The sysadmin had to
send out a notice asking everybody to refrain from using sync until the
archival process had completed.

Now that's not a common situation, but I think it shows how doing things that
cause system-wide effects is unwise.

--
greg


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [pgsql-hackers-win32] fsync with sync, and Win32 unlink
Date: 2004-03-11 18:46:41
Message-ID: 21654.1079030801@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-hackers-win32

Greg Stark <gsstark(at)mit(dot)edu> writes:
> I've seen some pretty severe damage caused by calling sync(2) on a loaded
> system. The system in question was in the process of copying data to an NFS
> mounted archival site. When the sync hit basically everything stopped until
> the buffered network writes could be synced. The live database was basically
> frozen for a few seconds and the web site nearly crashed. The sysadmin had to
> send out a notice asking everybody to refrain from using sync until the
> archival process had completed.

This seems, um, hard to believe. Did he shut down the standard syncer
daemon? I have never seen a Unix system that would allow more than
thirty seconds' worth of unwritten buffers to accumulate, and would not
care to use one if it existed.

regards, tom lane


From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [pgsql-hackers-win32] fsync with sync, and Win32 unlink
Date: 2004-03-11 19:01:05
Message-ID: 87vflb5hu6.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-hackers-win32


Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> This seems, um, hard to believe. Did he shut down the standard syncer
> daemon? I have never seen a Unix system that would allow more than
> thirty seconds' worth of unwritten buffers to accumulate, and would not
> care to use one if it existed.

Well it was Solaris so it didn't have the BSD 30s sync style strategy. But
this was a large NFS file transfer to another host on a 100Mb/s network. In
30s there could be a lot of writes buffered up.

I'm not saying the behaviour was ideal, and I don't know exactly why it
interfered with anything else. But I'm not entirely surprised either.

--
greg