Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Mar 2001 23:57:45 -0800
From:      Peter Wemm <peter@netplex.com.au>
To:        Matt Dillon <dillon@earth.backplane.com>, Julian Elischer <julian@elischer.org>, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/nfs nfs_node.c 
Message-ID:  <200103180757.f2I7vjh19781@mobile.wemm.org>

next in thread | raw e-mail | index | archive | help
Peter Wemm wrote:
> Matt Dillon wrote:
> >     I'd like to see this in -stable after the freeze is over!
> 
> We cannot wait at Yahoo.  Other changes in the name caching have made
> this a showstopper and has halted one of our key 2.2.x -> 4.x upgrade process
    es
> as faster machines running 4.x cannot handle the load that 2.2.8 did.
> We're running it already for testing to see if that is the only new problem
> that that group of machines turns up..

Actually, this didn't quite come out the way I meant.  At work, we do
our own internal releases etc.  There probably wouldn't be more than a
handful of machines running an actual FreeBSD -RELEASE of some form.

In it's simplest form, the following works just as well for fixing the 
lousy nfs client performance:

Index: nfs_node.c
===================================================================
RCS file: /home/ncvs/src/sys/nfs/nfs_node.c,v
retrieving revision 1.36
diff -c -r1.36 nfs_node.c
*** nfs_node.c	2000/01/05 05:11:36	1.36
--- nfs_node.c	2001/03/18 07:55:45
***************
*** 75,94 ****
  /*
   * Compute an entry in the NFS hash table structure
   */
! u_long
  nfs_hash(fhp, fhsize)
  	register nfsfh_t *fhp;
  	int fhsize;
  {
  	register u_char *fhpp;
! 	register u_long fhsum;
  	register int i;
  
  	fhpp = &fhp->fh_bytes[0];
! 	fhsum = 0;
! 	for (i = 0; i < fhsize; i++)
! 		fhsum += *fhpp++;
! 	return (fhsum);
  }
  
  /*
--- 75,98 ----
  /*
   * Compute an entry in the NFS hash table structure
   */
! #define FNV_32_PRIME ((u_int32_t) 0x01000193UL)
! #define FNV1_32_INIT ((u_int32_t) 33554467UL)
! u_int32_t
  nfs_hash(fhp, fhsize)
  	register nfsfh_t *fhp;
  	int fhsize;
  {
  	register u_char *fhpp;
! 	register u_int32_t hval;
  	register int i;
  
  	fhpp = &fhp->fh_bytes[0];
! 	hval = FNV1_32_INIT;
! 	for (i = 0; i < fhsize; i++) {
! 		hval *= FNV_32_PRIME;
! 		hval ^= (u_int32_t)*fhpp++;
! 	}
! 	return (hval);
  }
  
  /*


> > 						-Matt
> > 
> > :Peter Wemm wrote:
> > :> 
> > :> peter       2001/03/16 21:43:01 PST
> > :> 
> > :>   Modified files:
> > :>     sys/nfs              nfs_node.c
> > :>   Log:
> > :>   Dramatically improve the **lame** nfs_hash().  This is based on the
> > :>   Fowler / Noll / Vo Hash (http://www.isthe.com/chongo/tech/comp/fnv/).
> > :> 
> > :>   This improves hash coverage a *massive* amount.  We were seeing one
> > :>   set of machines that were using 0.84% of their 131072 entry nfsnode
> > :>   hash buckets with maximum chain lengths of up to ~500 entries.  The
> > :>   machine was spending nearly 100% of its time in 'system'.
> > :>   A test with this has pushed the coverage from a few perCent up to 91%
> > :>   utilization with a max chain length of 11.
> > :> 
> > :>   Submitted by:  David Filo
> > :
> > :tell David that it's nice to see he's still keeping his hand in..
> > :
> > :> 
> > :>   Revision  Changes    Path
> > :>   1.43      +17 -9     src/sys/nfs/nfs_node.c
> > :
> > :-- 
> > :      __--_|\  Julian Elischer
> > :     /       \ julian@elischer.org
> > :    (   OZ    ) World tour 2000-2001
> > :---> X_.---._/  
> > :            v
> > 
> > 
> 
> Cheers,
> -Peter
> --
> Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au
> "All of this is for nothing if we don't go to the stars" - JMS/B5
> 

Cheers,
-Peter
--
Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au
"All of this is for nothing if we don't go to the stars" - JMS/B5


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200103180757.f2I7vjh19781>