X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id F1AA0329E75 for ; Mon, 13 Sep 2004 22:15:05 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 48563-03 for ; Mon, 13 Sep 2004 21:14:59 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id 7768C329E4C for ; Mon, 13 Sep 2004 22:14:58 +0100 (BST) Received: from [64.81.245.111] (account josh@agliodbs.com HELO temoku.sf.agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 6346224; Mon, 13 Sep 2004 14:16:18 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Gaetano Mendola Subject: Re: Determine optimal fdatasync/fsync, O_SYNC/O_DSYNC options Date: Mon, 13 Sep 2004 14:15:59 -0700 User-Agent: KMail/1.6.2 Cc: pgsql-performance@postgresql.org References: <1095055866.414539fadb90d@webmail.rawbw.com> <200409131438.i8DEc8r04384@candle.pha.pa.us> <414602D5.3000506@bigfoot.com> In-Reply-To: <414602D5.3000506@bigfoot.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200409131415.59936.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/92 X-Sequence-Number: 8220 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