public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: jlnance@unity.ncsu.edu
To: linux-kernel@vger.kernel.org
Cc: cmp@synopsys.com
Subject: Awful NFS performance with attached test program
Date: Mon, 19 Jan 2004 16:16:49 -0500	[thread overview]
Message-ID: <20040119211649.GA20200@ncsu.edu> (raw)

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

             reply	other threads:[~2004-01-19 21:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-19 21:16 jlnance [this message]
2004-01-19 21:53 ` Awful NFS performance with attached test program 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040119211649.GA20200@ncsu.edu \
    --to=jlnance@unity.ncsu.edu \
    --cc=cmp@synopsys.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox