[ltp] Slightly OT: Filesystem performance on SSD vs HDD: test data request

Richard Neill linux-thinkpad@linux-thinkpad.org
Mon, 17 Aug 2009 20:22:42 +0100


This is a multi-part message in MIME format.
--------------070404040308000609040901
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Dear All,

I've been looking into filesystem performance for postgresql on various 
configurations. I've found out quite a lot. I'm still curious about how 
it works on a really good SSD; does anyone have an Intel X-25 that they 
would be willing to run a simple test with?

* Postgresql's main issue is when it is doing writes, and is frequently 
very very much i/o-bound. The important measurement is fdatasync() 
speed, not write throughput.

* I have 2 nearly equivalent test machines (apart from the disks):

      T60p, Core 2.0 GHz, 100GB, 7200 rpm HDD (travelstar)
      Ubuntu Hardy

      X60,  Core 2.0 GHz, 64 GB SSD (OCZ Core 2)
      Ubuntu Jaunty

In normal use, the X60 feels faster, and I am very happy with the SSD 
for day-to-day use. But postgres really feels slow.


* What I've measured so far:

     Test                     	Time on X60	Time on T60p

   hdparm -t			94 MB/s		48 MB/s

   syncspeed (ext2)              3.71 s           0.78 s
   syncspeed (ext3)              11.4 s           2.1 s
   syncspeed (ext4)              5.9 s            n/a


The T60p is running a kernel which doesn't support ext4
syncspeed is a simple c program - see below



* Implications (approximately)

   => The SSD is much faster for reads.

   => The SSD is 5 times slower for writes.

   =>  Ext2 is 3 times faster than Ext3 for database workloads
       [But it may not be as reliable]

   =>  Ext4 is 2 times faster than Ext3


* However, I know that the X-25 is supposed to be very much better than
   almost all the competing SSDs.   Would any X-25 owner be prepared to
   run the following test:


    compile syncspeed (attached):
        make syncspeed
    run test:
        rm -f test.dat; time ./syncspeed test.dat

    The result will be something like:
       real    0m2.044s
       user    0m0.000s
       sys     0m0.048s

    Let me know what the filesystem is too.



Thanks very much for your input,

Richard



--------------070404040308000609040901
Content-Type: text/x-csrc;
 name="syncspeed.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="syncspeed.c"

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#define NUM_ITER 1024

int main ( int argc, char **argv ) {
	const char data[] = "Liberate";
	size_t data_len = strlen ( data );
	const char *filename;
	int fd; 
	unsigned int i;

	if ( argc != 2 ) {
		fprintf ( stderr, "Syntax: %s output_file\n", argv[0] );
		exit ( 1 );
	}
	filename = argv[1];
	fd = open ( filename, ( O_WRONLY | O_CREAT | O_EXCL ), 0666 );
	if ( fd < 0 ) {
		fprintf ( stderr, "Could not create \"%s\": %s\n",
			  filename, strerror ( errno ) );
		exit ( 1 );
	}

	for ( i = 0 ; i < NUM_ITER ; i++ ) {
		if ( write ( fd, data, data_len ) != data_len ) {
			fprintf ( stderr, "Could not write: %s\n",
				  strerror ( errno ) );
			exit ( 1 );
		}
		if ( fdatasync ( fd ) != 0 ) {
			fprintf ( stderr, "Could not fdatasync: %s\n",
				  strerror ( errno ) );
			exit ( 1 );
		}
	}
	return 0;
}

--------------070404040308000609040901--