From: mcclure@tiguex.cs.unm.edu (Brent McClure)
Subject: Slow random file access under OSF/1 on Dec alpha
Date: Thu, 26 Aug 1993 15:38:56 GMT [thread overview]
Message-ID: <CCDI3H.400@tiguex.cs.unm.edu> (raw)
I'm experiencing extremely slow file accesses when I have code that jumps
around in a file and accesses it at random locations. The following
sample program brings out the problem, and if the output file "foo" is
large enough ( greater than about 65536 bytes on our system ) then
this program runs _much_ slower on our Dec Alpha than on any other
unix I can find to run it on.
The interesting thing is if RECS and RECSIZE are tuned so that the size
of "foo" is around 2^16, then there is a dramatic change in the speed
of this program as you cross this size boundary.
My guess is that there is some kernel parameter that I can tune to
change this behavior, but I'm not sure what this would be. Can anyone
suggest anything, or see if this occurs on your system?
Our osf version ( from uname -a ):
OSF1 jeremy 1.2 10 alpha
thanks, Brent
mcclure@cs.unm.edu
---------------------------------------------------------------------------
#include<stdio.h>
#include <fcntl.h>
/*
* A combination of 13*5042 runs much slower on my alpha than 13*5041.
*/
#define RECSIZE 13
#define RECS 5042
char buf[128];
char nbuf[128];
main()
{
int fd,i, val;
/* make a couple of bogus buffers to write out */
for( i = 0; i < RECSIZE; i++ ) {
buf[i] = 'X';
nbuf[i] = 'O';
}
fd = open("./foo",O_CREAT|O_RDWR,0644);
/* unbuffer stdout so I can see how fast things are printing out */
setbuf(stdout,NULL);
printf("creating file...\n");
for( i = 0; i < RECS; i++ ) {
write(fd,buf,RECSIZE);
if ( !(i%100) )
printf("%d ",i);
}
printf("\n");
printf("random access...\n");
for( i = 0; i < RECS; i++ ) {
val = rand()%RECS;
lseek(fd,0,0);
lseek(fd,val*RECSIZE,0);
write(fd,nbuf,RECSIZE);
if ( !(i%100) )
printf("%d ",val*RECSIZE);
}
printf("\n");
}
---------------------------------------------------------------------------
next reply other threads:[~1993-08-26 15:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1993-08-26 15:38 Brent McClure [this message]
1993-08-27 0:36 ` Slow random file access under OSF/1 on Dec alpha Alan Rollow - Alan's Home for Wayward Tumbleweeds.
1993-08-31 12:01 ` Jari Tavi
1993-09-03 18:38 ` Tom McCabe
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox