🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #8734

NFS V3 problem with readdir(3C)

#8734
From: Tim Thompson
Date: Mon, 24 Jun 1996 00:00
87 lines
3395 bytes
  I've got a cluster of Sun Sparc 10's and 20's, all running Solaris 2.5.1
  (NOT 2.5). Via a private NFS network (10Base-T), /var/spool/news is shared
  amongst them. We're using NFS to separate "feeding" functionality from
  "reading" functionality. It works well for us; well, it works well for
  us provided we don't use NFS V3.

  Part of the reason we went to Solaris 2.5 (and then 2.5.1 due to a bug
  in 2.5 where some sort of inode cache would exhaust all kernel memory)
  was because it was rumored that NFS V3 would provide us with much 
  better performance than V2. However, it appears that readdir(3C) is
  *much* slower in a V3 environment than in V2.
  
  On our test machine, I've put the following entries in /etc/vfstab:

	machine:/var/spool/news   -    /V2  nfs  -    yes  vers=2
	machine:/var/spool/news   -    /V3  nfs  -    yes  vers=3

  I've created the directories /V2 and /V3, and then mounted the file
  systems:

  $ mount | grep V

  /V2 on machine:/var/spool/news vers=2/remote on Mon Jun 24 13:28:04 1996
  /V3 on machine:/var/spool/news vers=3/remote on Mon Jun 24 13:28:06 1996

  Then I run this short test program (included below). Notice the time to 
  look at things on the file system mounted using NFS Version 2 is *much*
  less than the time on the file system mounted using NFS version 3.

	$ ./testprog /V2/alt/test
	START TIME: Mon Jun 24 15:20:58 1996
	 
	END TIME: Mon Jun 24 15:21:00 1996
	 
	$ ./testprog /V3/alt/test
	START TIME: Mon Jun 24 15:21:04 1996
	 
	END TIME: Mon Jun 24 15:27:30 1996
	 
  Granted, I've only shown a sample of one here, but the results are 
  consistent: the time to run on the V3 file system is always considerable
  more than on the V2 file system.

  It looks like the readdir(3C) system call is taking an inordinate amount
  of time when NFS V3 is being used.

  Any/all suggestions are most welcome.

					Tim Thompson
					tgt@lucent.com

P.S. I've got a call into Sun support on this problem.

========================> cut here <=======================
#include <dirent.h>
 
main(argc,argv)
int argc;
char *argv[];
{
    register struct dirent      *ep;
    register DIR        *dp;
    long now;
 
    dp = opendir(argv[1]);
 
    if (dp == NULL) {
        printf("No such directory!\n");
        exit(-1);
    }
 
    now = time(0);
    printf("START TIME: %s\n", ctime(&now));
    while ((ep = readdir(dp)) != NULL)
        ;
 
    now = time(0);
    printf("END TIME: %s\n", ctime(&now));
}
-- 
This is an all-natural posting, containing | Tim Thompson
no artificial colorings, flavorings, or    | Netnews Service Manager/Engineer
preservatives.                             | Lucent Technologies
                                           | tgt@lucent.com

Technical Details
Message-ID: <4qmr2b$64s@nntpa.cb.lucent.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <4qmr2b$64s@nntpa.cb.lucent.com>
Subject: NFS V3 problem with readdir(3C)
Date: Mon, 24 Jun 1996 00:00:00 +0000
From: tgt@pongo.cb.att.com (Tim Thompson)
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 161894770
Distribution: inet
Organization: AT&T Bell Labs, Columbus, Ohio
Newsgroups: comp.unix.solaris,news.software.nntp