Change nfsstat client statistics to report actual RPC counts
John Baldwin
jhb at freebsd.org
Tue Jan 28 20:45:35 UTC 2014
I had always assumed that when you ran 'nfsstat -c 1' you saw counts of actual
RPCs sent over the wire (similar to how 'netstat 1' show actual packets /
bytes, 'iostat 1' shows actual disk transactions / bytes, etc.). I was
surprised to find that 'nfsstat -c' does not show actual RPC counts. Instead,
it shows theoretical RPC counts as if the client did no caching at all. (This
would be akin to 'iostat 1' showing a disk transaction for every read() system
call). In general when I'm using 'nfsstat -c 1', I'm using it to get a
summary of what the NFS client is actually sending over the wire, not the
theoretical numbers. To that end, I have a patch to change nfsstat back to
reporting raw RPC count deltas instead of theoretical deltas. (It used to
report raw RPC counts back before 4.0.) If you are curious about the
effectiveness of the client side caches, that data can still be obtained via
the existing '-W' flag.
Index: nfsstat.c
===================================================================
--- nfsstat.c (revision 261241)
+++ nfsstat.c (working copy)
@@ -604,14 +604,15 @@
if (clientOnly) {
printf("%s %6d %6d %6d %6d %6d %6d %6d %6d",
((clientOnly && serverOnly) ? "Client:" : ""),
- DELTA(attrcache_hits) + DELTA(attrcache_misses),
- DELTA(lookupcache_hits) + DELTA(lookupcache_misses),
- DELTA(biocache_readlinks),
- DELTA(biocache_reads),
- DELTA(biocache_writes),
- nfsstats.rpccnt[NFSPROC_RENAME]-lastst.rpccnt[NFSPROC_RENAME],
- DELTA(accesscache_hits) + DELTA(accesscache_misses),
- DELTA(biocache_readdirs)
+ DELTA(rpccnt[NFSPROC_GETATTR]),
+ DELTA(rpccnt[NFSPROC_LOOKUP]),
+ DELTA(rpccnt[NFSPROC_READLINK]),
+ DELTA(rpccnt[NFSPROC_READ]),
+ DELTA(rpccnt[NFSPROC_WRITE]),
+ DELTA(rpccnt[NFSPROC_RENAME]),
+ DELTA(rpccnt[NFSPROC_ACCESS]),
+ DELTA(rpccnt[NFSPROC_READDIR]) +
+ DELTA(rpccnt[NFSPROC_READDIRPLUS])
);
if (widemode) {
printf(" %s %s %s %s %s %s",
@@ -993,15 +994,15 @@
if (clientOnly) {
printf("%s %6d %6d %6d %6d %6d %6d %6d %6d",
((clientOnly && serverOnly) ? "Client:" : ""),
- DELTA(attrcache_hits) + DELTA(attrcache_misses),
- DELTA(lookupcache_hits) + DELTA(lookupcache_misses),
- DELTA(biocache_readlinks),
- DELTA(biocache_reads),
- DELTA(biocache_writes),
- nfsstats.rpccnt[NFSPROC_RENAME] -
- lastst.rpccnt[NFSPROC_RENAME],
- DELTA(accesscache_hits) + DELTA(accesscache_misses),
- DELTA(biocache_readdirs)
+ DELTA(rpccnt[NFSPROC_GETATTR]),
+ DELTA(rpccnt[NFSPROC_LOOKUP]),
+ DELTA(rpccnt[NFSPROC_READLINK]),
+ DELTA(rpccnt[NFSPROC_READ]),
+ DELTA(rpccnt[NFSPROC_WRITE]),
+ DELTA(rpccnt[NFSPROC_RENAME]),
+ DELTA(rpccnt[NFSPROC_ACCESS]),
+ DELTA(rpccnt[NFSPROC_READDIR]) +
+ DELTA(rpccnt[NFSPROC_READDIRPLUS])
);
if (widemode) {
printf(" %s %s %s %s %s %s",
--
John Baldwin
More information about the freebsd-current
mailing list