Subject: Re: wd(4) questions
To: Dieter <netbsd@sopwith.solgatos.com>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-help
Date: 08/22/2005 11:38:21
--ZGiS0Q5IWpPtfppv
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sun, Aug 21, 2005 at 03:56:38PM +0100, Dieter wrote:
> > > I was expecting write to be slower than read, but not this much slower.
> > > Is this typical, or do I have something wierd going on?
> > 
> > Maybe you have the write cache turned off ?
> 
> Of course!
> 
> Since it isn't running production yet, I turned the disk's
> write cache back on, and the write speed increased from
> 6.5 MB/s to 7.7 MB/s.  Still a lot slower than I would expect.
> 
> I looked at a review of the drive, and they got 69.8 MB/s
> at the beginning of the disk and 39.9 MB/s at the end
> (reading).  I get about 37 MB/s regardless of where on
> the disk I'm reading.  Their disk is the 400 GB (3 platters),
> mine are the 250 GB (2 platters).

This can make a difference, but not that big.

> Seagate's pdf file says
> "Sustained Transfer Rate OD (Mbytes/sec)" is 65 for both models.
> (doesn't specify read or write. or explain what "OD" means)

Please try the attached test program:
./tst /dev/rwd0c 10000

this will report the speed of the bus (data transfers between the disk's
cache and main memory). Maybe you're hitting the limit of what the hardware
can do here.

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

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

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

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);
}

--ZGiS0Q5IWpPtfppv--