summaryrefslogtreecommitdiffstats
path: root/sys/nfsserver
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2003-06-21 21:01:44 +0000
committermckusick <mckusick@FreeBSD.org>2003-06-21 21:01:44 +0000
commit6e4d4545607ba5d163fb65614d9ca74362cb9182 (patch)
tree59b692dafbfa68af9c3758e4f7b3ec4561233d37 /sys/nfsserver
parent6731c07a2f9d713b7e4e988b79593ef147202372 (diff)
downloadFreeBSD-src-6e4d4545607ba5d163fb65614d9ca74362cb9182.zip
FreeBSD-src-6e4d4545607ba5d163fb65614d9ca74362cb9182.tar.gz
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 <ellard@eecs.harvard.edu> Sponsored by: DARPA & NAI Labs.
Diffstat (limited to 'sys/nfsserver')
-rw-r--r--sys/nfsserver/nfs_serv.c8
1 files changed, 4 insertions, 4 deletions
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];
}
OpenPOWER on IntegriCloud