From owner-freebsd-current@FreeBSD.ORG Tue Jan 28 20:45:35 2014 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2D7A5EBA; Tue, 28 Jan 2014 20:45:35 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 05CC317CF; Tue, 28 Jan 2014 20:45:35 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7C8BDB941; Tue, 28 Jan 2014 15:45:33 -0500 (EST) From: John Baldwin To: current@freebsd.org Subject: Change nfsstat client statistics to report actual RPC counts Date: Tue, 28 Jan 2014 15:45:30 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20130906; KDE/4.5.5; amd64; ; ) MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201401281545.30164.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 28 Jan 2014 15:45:33 -0500 (EST) Cc: Rick Macklem X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jan 2014 20:45:35 -0000 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