Subject: Re: Massive read/write performance problems with 3.0
To: Tonnerre LOMBARD <tonnerre@bsdprojects.net>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: port-amd64
Date: 05/08/2006 13:23:22
--7JfCtLOvnd9MIVvH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Mon, May 08, 2006 at 06:22:43AM +0200, Tonnerre LOMBARD wrote:
> Salut,
> 
> On Mon, May 08, 2006 at 12:15:12AM +0200, Manuel Bouyer wrote:
> > What is your disk system ? Maybe your SATA controller isn't properly
> > supported.
> 
> It's NVidia NForce, using the viaide driver.
> 
> > Also, you may have better speed using 64k blocks with dd
> 
> Shouldn't the scheduler accumulate 4 operations with some kind of
> "Nagle's Algorithm for I/O schedulers"?

It should, and it does on my system at last (in my case, bs=16k was even
a little faster ...)

Can you try the attached program ? It will benchmark the IDE bus's bandwidth:
./tst /dev/rwd0d 10000

it should run for a few seconds to give usefull results; if it doesn't
use something larger than 10000

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--

--7JfCtLOvnd9MIVvH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tst.c"

#include <fcntl.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>

int
main(int argc, char **argv)
{
	static char buf[64*1024];
	int fd, i;
	struct timeval tv0, tv1;
	int t;

	fd = open(argv[1], O_RDONLY, 0);
	if (fd < 0) {
		perror("open");
		exit(1);
	}
	if (gettimeofday(&tv0, NULL) < 0) {
		perror("gettimeofday");
		exit(1);
	}
	for (i = 0; i < atoi(argv[2]); i++) {
		if (read(fd, buf, sizeof(buf)) != sizeof(buf)) {
			perror("read");
			exit(1);
		}
		if (lseek(fd, 0, SEEK_SET) < 0) {
			perror("seek");
			exit(1);
		}
			
	}
	if (gettimeofday(&tv1, NULL) < 0) {
		perror("gettimeofday");
		exit(1);
	}
	t = (tv1.tv_sec - tv0.tv_sec) * 1000000;
	t = t + tv1.tv_usec - tv0.tv_usec;
	printf("%d us, %f MB/s\n", t,
	    ((double)64 * (double)i / 1024) / ((double)t / 1000000));
	exit(0);
}

--7JfCtLOvnd9MIVvH--