Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
* Slow random file access under OSF/1 on Dec alpha
@ 1993-08-26 15:38 Brent McClure
  1993-08-27  0:36 ` Alan Rollow - Alan's Home for Wayward Tumbleweeds.
  1993-08-31 12:01 ` Jari Tavi
  0 siblings, 2 replies; 4+ messages in thread
From: Brent McClure @ 1993-08-26 15:38 UTC (permalink / 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");
}
---------------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1993-09-03 18:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-08-26 15:38 Slow random file access under OSF/1 on Dec alpha Brent McClure
1993-08-27  0:36 ` Alan Rollow - Alan's Home for Wayward Tumbleweeds.
1993-08-31 12:01 ` Jari Tavi
1993-09-03 18:38   ` Tom McCabe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox