Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jan 2004 20:17:58 +0100
From:      =?ISO-8859-1?Q?Bj=F6rn_Gr=F6nvall?= <bg@sics.se>
To:        Robert Watson <rwatson@freebsd.org>
Cc:        current@freebsd.org
Subject:   Re: Old SUN NFS performance papers.
Message-ID:  <20040127201758.13be4f08.bg@sics.se>
In-Reply-To: <Pine.NEB.3.96L.1040124210942.31483E-100000@fledge.watson.org>
References:  <003c01c3de8d$d569edb0$471b3dd4@dual> <Pine.NEB.3.96L.1040124210942.31483E-100000@fledge.watson.org>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Sat, 24 Jan 2004 21:14:51 -0500 (EST)
Robert Watson <rwatson@freebsd.org> wrote:

> I haven't done much benchmarking on NFS lately, but something worth
> remembering is that people have spent a lot of time researching and
> optimizing TCP for a variety of connection types, whereas the NFS code
> basically has a static implementation of RPC backoff and flow control that
> hasn't evolved much.

One reason that FreeBSD users experience poor NFSv3/TCP performance is
that the defaults for rsize and wsize is unusually small, only
8k. Solaris and HP-UX defaults to 32k for a good reason. I guess TCP
simply needs a little bit more data to chew on to be efficient.

I tested this on 5.2-CURRENT and found that large file read
performance went up from 56Mbit/s to 80Mbit/s, an improvement by 43%.

I have written a patch that makes FreeBSD use the same defaults as
Solaris and HP-UX. Note that with NFSv3 there is no risk associated
with specifying to large values for [rw]size. The server automatically
limits these values in the fsinfo rpc. Patch is attached.

Cheers,
Björn

-- 
  _     _                                           ,_______________.
Bjorn Gronvall (Björn Grönvall)                    /_______________/|
Swedish Institute of Computer Science              |               ||
PO Box 1263, S-164 29 Kista, Sweden                | Schroedingers ||
Email: bg@sics.se, Phone +46 -8 633 15 25          |      Cat      |/
Cellular +46 -70 768 06 35, Fax +46 -8 751 72 30   '---------------'

[-- Attachment #2 --]
--- /usr/src/sys/nfsclient/nfs_vfsops.c.orig	Sat Nov 22 03:21:49 2003
+++ /usr/src/sys/nfsclient/nfs_vfsops.c	Tue Jan 27 19:26:35 2004
@@ -359,6 +359,7 @@
 		maxfsize = fxdr_hyper(&fsp->fs_maxfilesize);
 		if (maxfsize > 0 && maxfsize < nmp->nm_maxfilesize)
 			nmp->nm_maxfilesize = maxfsize;
+		nmp->nm_mountp->mnt_stat.f_iosize = nfs_iosize(nmp);
 		nmp->nm_state |= NFSSTA_GOTFSINFO;
 	}
 	m_freem(mrep);
@@ -785,8 +786,12 @@
 
 	nmp->nm_timeo = NFS_TIMEO;
 	nmp->nm_retry = NFS_RETRANS;
-	nmp->nm_wsize = NFS_WSIZE;
-	nmp->nm_rsize = NFS_RSIZE;
+	if ((argp->flags & NFSMNT_NFSV3) && argp->sotype == SOCK_STREAM) {
+		nmp->nm_wsize = nmp->nm_rsize = NFS_MAXDATA;
+	} else {
+		nmp->nm_wsize = NFS_WSIZE;
+		nmp->nm_rsize = NFS_RSIZE;
+	}
 	nmp->nm_readdirsize = NFS_READDIRSIZE;
 	nmp->nm_numgrps = NFS_MAXGRPS;
 	nmp->nm_readahead = NFS_DEFRAHEAD;
@@ -832,10 +837,14 @@
 	*vpp = NFSTOV(np);
 
 	/*
-	 * Get file attributes for the mountpoint.  This has the side
-	 * effect of filling in (*vpp)->v_type with the correct value.
+	 * Get file attributes and transfer parameters for the
+	 * mountpoint.  This has the side effect of filling in
+	 * (*vpp)->v_type with the correct value.
 	 */
-	VOP_GETATTR(*vpp, &attrs, curthread->td_ucred, curthread);
+	if (argp->flags & NFSMNT_NFSV3)
+		nfs_fsinfo(nmp, *vpp, curthread->td_ucred, curthread);
+	else
+		VOP_GETATTR(*vpp, &attrs, curthread->td_ucred, curthread);
 
 	/*
 	 * Lose the lock but keep the ref.
@@ -905,6 +914,13 @@
 	if (error)
 		return (error);
 	vp = NFSTOV(np);
+	/*
+	 * Get transfer parameters and attributes for root vnode once.
+	 */
+	if ((nmp->nm_state & NFSSTA_GOTFSINFO) == 0 &&
+	    (nmp->nm_flag & NFSMNT_NFSV3)) {
+		nfs_fsinfo(nmp, vp, curthread->td_ucred, curthread);
+	}
 	if (vp->v_type == VNON)
 	    vp->v_type = VDIR;
 	vp->v_vflag |= VV_ROOT;
help

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