From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,dd567a39a97cf156,start X-Google-Attributes: gidf678f,public X-Google-ArrivalTime: 1993-08-26 10:51:34 PST Newsgroups: comp.unix.osf.misc Path: gmd.de!xlink.net!howland.reston.ans.net!spool.mu.edu!umn.edu!lynx.unm.edu!mimbres.cs.unm.edu!tiguex.cs.unm.edu!mcclure From: mcclure@tiguex.cs.unm.edu (Brent McClure) Subject: Slow random file access under OSF/1 on Dec alpha Message-ID: Sender: news@tiguex.cs.unm.edu Organization: Computer Science Department, University of New Mexico Date: Thu, 26 Aug 1993 15:38:56 GMT 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 #include /* * 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"); } ---------------------------------------------------------------------------