Cached file read performance with 6.2-PRERELEASE

Mark Kirkwood markir at
Thu Dec 21 07:10:30 PST 2006

Mark Kirkwood wrote:
> Pieter de Goeje wrote:

>> It would be more interesting to see how random access to a (cached) 
>> file performs in Linux vs FreeBSD, which seems a more logical pattern 
>> for a database.
> Agreed, and good point, I'll knock up a simple program to do random 
> and/or sequential access of a file and see what we get!

Here's a (very) simple program that does block reads sequentially or 
randomly. It probably needs a little polishing, but seems to work ok for 
the size of files we are interested in: i.e < a few GB (see attached):


Compiled with CFLAGS=-O2 -march=i686

Gentoo - 2.6.18-gentoo-r3:

$ ./readtest /data0/dump/file 8192 0
random reads: 100000 elapsed: 1.2646 io rate 647805551 bytes/s

$ ./readtest /data0/dump/file 8192 1
sequential reads: 100000 elapsed: 1.1267 io rate 727075854 bytes/s

FreeBSD - 6.2-PRERELEASE #7: Mon Nov 27 19:32:33 NZDT 2006 :

  ./readtest /data0/dump/file 8192 0
random reads: 100000 elapsed: 4.3669 io rate 187594060 bytes/s

$ ./readtest /data0/dump/file 8192 1
sequential reads: 100000 elapsed: 1.9679 io rate 416283642 bytes/s

So looks like we get faster overall results than dd (I guess not needing 
to send output anywhere helps)...also we seem to be slower in the random 
case too :-(. I ran these programs several times, typical results shown.



More information about the freebsd-stable mailing list