From 6e4d4545607ba5d163fb65614d9ca74362cb9182 Mon Sep 17 00:00:00 2001 From: mckusick Date: Sat, 21 Jun 2003 21:01:44 +0000 Subject: Increase the size of the NFS server hash table to improve performance when serving up more than about 32 active files. For details see section 6.3 (pg 111) of Daniel Ellard and Margo Seltzer, ``NFS Tricks and Benchmarking Traps'' in the Proceedings of the Usenix 2003 Freenix Track, June 9-14, 2003 pg 101-114. Obtained from: Daniel Ellard Sponsored by: DARPA & NAI Labs. --- sys/nfsserver/nfs_serv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/nfsserver') diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c index ae3f944..9384016 100644 --- a/sys/nfsserver/nfs_serv.c +++ b/sys/nfsserver/nfs_serv.c @@ -109,7 +109,7 @@ __FBSDID("$FreeBSD$"); #define MAX_COMMIT_COUNT (1024 * 1024) -#define NUM_HEURISTIC 64 +#define NUM_HEURISTIC 1017 #define NHUSE_INIT 64 #define NHUSE_INC 16 #define NHUSE_MAX 2048 @@ -819,13 +819,13 @@ nfsrv_read(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, { int hi; - int try = 4; + int try = 32; /* * Locate best candidate */ - hi = ((int)(vm_offset_t)vp / sizeof(struct vnode)) & (NUM_HEURISTIC - 1); + hi = ((int)(vm_offset_t)vp / sizeof(struct vnode)) % NUM_HEURISTIC; nh = &nfsheur[hi]; while (try--) { @@ -835,7 +835,7 @@ nfsrv_read(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, } if (nfsheur[hi].nh_use > 0) --nfsheur[hi].nh_use; - hi = (hi + 1) & (NUM_HEURISTIC - 1); + hi = (hi + 1) % NUM_HEURISTIC; if (nfsheur[hi].nh_use < nh->nh_use) nh = &nfsheur[hi]; } -- cgit v1.1