pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Gaetano Mendola <mendola@bigfoot.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Determine optimal fdatasync/fsync, O_SYNC/O_DSYNC options
Date: Mon, 13 Sep 2004 14:15:59 -0700
Message-ID: <200409131415.59936.josh@agliodbs.com> (raw)
In-Reply-To: <414602D5.3000506@bigfoot.com>
References: <1095055866.414539fadb90d@webmail.rawbw.com>
	<200409131438.i8DEc8r04384@candle.pha.pa.us>
	<414602D5.3000506@bigfoot.com>

Gaetano,

> Now that the argument is already open, why postgres choose
> on linux fdatasync? I'm understanding from other posts that
> on this platform open_sync is better than fdatasync.

Not necessarily.   For example, here's my test results, on Linux 2.6.7, 
writing to a ReiserFS mount on a Software RAID 1 slave of 2 IDE disks, on an 
Athalon 1600mhz single-processor machine.   I ran the loop 10,000 times 
instead of 1000 because tests with 1,000 varied too much.

Simple write timing:
        write                    0.088701

Compare fsync times on write() and non-write() descriptor:
(If the times are similar, fsync() can sync data written
 on a different descriptor.)
        write, fsync, close      3.593958
        write, close, fsync      3.556978

Compare one o_sync write to two:
        one 16k o_sync write    42.951595
        two 8k o_sync writes    11.251389

Compare file sync methods with one 8k write:
        (o_dsync unavailable)
        open o_sync, write       6.807060
        write, fdatasync         7.207879
        write, fsync,            7.209087

Compare file sync methods with 2 8k writes:
        (o_dsync unavailable)
        open o_sync, write      13.120305
        write, fdatasync         7.583871
        write, fsync,            7.801748

-- 
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco



view thread (10+ messages)  latest in thread

Message-ID: <200409131415.59936.josh@agliodbs.com>
Permalink:  ../200409131415.59936.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200409131415.59936.josh@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: josh@agliodbs.com, mendola@bigfoot.com
  Subject: Re: Determine optimal fdatasync/fsync, O_SYNC/O_DSYNC options
  In-Reply-To: <200409131415.59936.josh@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox