test_fsync label adjustments

Bruce Momjian <bruce@momjian.us>

From: Bruce Momjian <bruce@momjian.us>
To: PostgreSQL-development <pgsql-hackers@postgreSQL.org>
Date: 2011-01-18T20:55:12Z
Lists: pgsql-hackers

Attachments

I have modified test_fsync to use test labels that match wal_sync_method
values, and and added more tests for open_sync with different sizes. 
This should make the program easier for novices to understand.  Here is
a test run for Ubuntu 11.04:

	$ ./test_fsync
	2000 operations per test
	
	Compare file sync methods using one 8k write:
	(in wal_sync_method preference order, except fdatasync
	is Linux's default)
	        open_datasync (non-direct I/O)*    85.127 ops/sec
	        open_datasync (direct I/O)         87.119 ops/sec
	        fdatasync                          81.006 ops/sec
	        fsync                              82.621 ops/sec
	        fsync_writethrough                            n/a
	        open_sync (non-direct I/O)*        84.412 ops/sec
	        open_sync (direct I/O)             91.006 ops/sec
	* This non-direct I/O mode is not used by Postgres.
	
	Compare file sync methods using two 8k writes:
	(in wal_sync_method preference order, except fdatasync
	is Linux's default)
	        open_datasync (non-direct I/O)*    42.721 ops/sec
	        open_datasync (direct I/O)         45.296 ops/sec
	        fdatasync                          76.665 ops/sec
	        fsync                              78.361 ops/sec
	        fsync_writethrough                            n/a
	        open_sync (non-direct I/O)*        42.311 ops/sec
	        open_sync (direct I/O)             45.247 ops/sec
	* This non-direct I/O mode is not used by Postgres.
	
	Compare open_sync with different write sizes:
	(This is designed to compare the cost of writing 16k
	in different write open_sync sizes.)
	         1 16k open_sync write             86.740 ops/sec
	         2  8k open_sync writes            44.709 ops/sec
	         4  4k open_sync writes            22.096 ops/sec
	         8  2k open_sync writes            10.856 ops/sec
	        16  1k open_sync writes             5.434 ops/sec
	
	Test if fsync on non-write file descriptor is honored:
	(If the times are similar, fsync() can sync data written
	on a different descriptor.)
	        write, fsync, close                86.802 ops/sec
	        write, close, fsync                85.766 ops/sec
	
	Non-sync'ed 8k writes:
	        write                              83.068 ops/sec
	
	

Applied patch attached.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +