public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Awful NFS performance with attached test program
@ 2004-01-19 21:16 jlnance
  2004-01-19 21:53 ` Trond Myklebust
  0 siblings, 1 reply; 9+ messages in thread
From: jlnance @ 2004-01-19 21:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: cmp

Hello All,
    The attached program demonstrates a problem I am having writing to
files on an NFS file system.  It works by creating a file, and then
seeking through the file to update it.  The problem I am seeing is that
the seek/update stage takes more than 10X as long as the amount of time
required to initially create the file.  And its not even seeking in
some strange pattern.

    I am running this with a 2.4.20 (red hat patched) kernel.  I have not
tried it with 2.6.  I have played with various mount options, but they
do not seem to make much difference.  Here is one example that I used:

sledge:/l0 /mnt/v3_tcp_8k nfs rw,v3,rsize=8192,wsize=8192,hard,intr,tcp,lock,addr=sledge 0 0

Anyone have any ideas or comments?

Thanks,

Jim


----------------------------------------------------------------------
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>

char buff[4096];

double dt(struct timeval *a, struct timeval *b)
{
  double sec = b->tv_usec - a->tv_usec;

  sec /= 1e6;
  sec += b->tv_sec - a->tv_sec;

  return sec;
}

int main()
{
  struct timeval a, b;
  int i;

  FILE *fp = fopen("testfile", "w");

  printf("Creating file: ");
  fflush(stdout);
  gettimeofday(&a, 0);
  for(i=0; i<100*1024; i++)
    fwrite(buff, 4096, 1, fp);
  fflush(fp);
  gettimeofday(&b, 0);

  printf("%.3f seconds\n", dt(&a, &b));

  printf("Updating file: ");
  fflush(stdout);
  gettimeofday(&a, 0);
  for(i=0; i<100*1024*sizeof(buff); i += 5000) {
    fseek(fp, i, SEEK_SET);
    fwrite(&i, sizeof(i), 1, fp);
  }
  gettimeofday(&b, 0);

  printf("%.3f seconds\n", dt(&a, &b));

  return 0;
}

^ permalink raw reply	[flat|nested] 9+ messages in thread
[parent not found: <20040119211649.GA20200@ncsu.edu.suse.lists.linux.kernel>]

end of thread, other threads:[~2004-01-21  2:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-19 21:16 Awful NFS performance with attached test program jlnance
2004-01-19 21:53 ` Trond Myklebust
2004-01-20 13:28   ` jlnance
2004-01-20 14:12     ` Trond Myklebust
2004-01-20 20:03       ` Chris Petersen
2004-01-20 21:50         ` Trond Myklebust
2004-01-21  2:01           ` jlnance
2004-01-20 20:31     ` Jan Dittmer
     [not found] <20040119211649.GA20200@ncsu.edu.suse.lists.linux.kernel>
     [not found] ` <1074549226.1560.59.camel@nidelv.trondhjem.org.suse.lists.linux.kernel>
     [not found]   ` <20040120132803.GA2830@ncsu.edu.suse.lists.linux.kernel>
     [not found]     ` <1074607946.1871.37.camel@nidelv.trondhjem.org.suse.lists.linux.kernel>
2004-01-20 14:38       ` Andi Kleen

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