162306a36Sopenharmony_ci============================
262306a36Sopenharmony_ciKernel NFS Server Statistics
362306a36Sopenharmony_ci============================
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci:Authors: Greg Banks <gnb@sgi.com> - 26 Mar 2009
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciThis document describes the format and semantics of the statistics
862306a36Sopenharmony_ciwhich the kernel NFS server makes available to userspace.  These
962306a36Sopenharmony_cistatistics are available in several text form pseudo files, each of
1062306a36Sopenharmony_ciwhich is described separately below.
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciIn most cases you don't need to know these formats, as the nfsstat(8)
1362306a36Sopenharmony_ciprogram from the nfs-utils distribution provides a helpful command-line
1462306a36Sopenharmony_ciinterface for extracting and printing them.
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ciAll the files described here are formatted as a sequence of text lines,
1762306a36Sopenharmony_ciseparated by newline '\n' characters.  Lines beginning with a hash
1862306a36Sopenharmony_ci'#' character are comments intended for humans and should be ignored
1962306a36Sopenharmony_ciby parsing routines.  All other lines contain a sequence of fields
2062306a36Sopenharmony_ciseparated by whitespace.
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci/proc/fs/nfsd/pool_stats
2362306a36Sopenharmony_ci========================
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ciThis file is available in kernels from 2.6.30 onwards, if the
2662306a36Sopenharmony_ci/proc/fs/nfsd filesystem is mounted (it almost always should be).
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ciThe first line is a comment which describes the fields present in
2962306a36Sopenharmony_ciall the other lines.  The other lines present the following data as
3062306a36Sopenharmony_cia sequence of unsigned decimal numeric fields.  One line is shown
3162306a36Sopenharmony_cifor each NFS thread pool.
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciAll counters are 64 bits wide and wrap naturally.  There is no way
3462306a36Sopenharmony_cito zero these counters, instead applications should do their own
3562306a36Sopenharmony_cirate conversion.
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_cipool
3862306a36Sopenharmony_ci	The id number of the NFS thread pool to which this line applies.
3962306a36Sopenharmony_ci	This number does not change.
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci	Thread pool ids are a contiguous set of small integers starting
4262306a36Sopenharmony_ci	at zero.  The maximum value depends on the thread pool mode, but
4362306a36Sopenharmony_ci	currently cannot be larger than the number of CPUs in the system.
4462306a36Sopenharmony_ci	Note that in the default case there will be a single thread pool
4562306a36Sopenharmony_ci	which contains all the nfsd threads and all the CPUs in the system,
4662306a36Sopenharmony_ci	and thus this file will have a single line with a pool id of "0".
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_cipackets-arrived
4962306a36Sopenharmony_ci	Counts how many NFS packets have arrived.  More precisely, this
5062306a36Sopenharmony_ci	is the number of times that the network stack has notified the
5162306a36Sopenharmony_ci	sunrpc server layer that new data may be available on a transport
5262306a36Sopenharmony_ci	(e.g. an NFS or UDP socket or an NFS/RDMA endpoint).
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci	Depending on the NFS workload patterns and various network stack
5562306a36Sopenharmony_ci	effects (such as Large Receive Offload) which can combine packets
5662306a36Sopenharmony_ci	on the wire, this may be either more or less than the number
5762306a36Sopenharmony_ci	of NFS calls received (which statistic is available elsewhere).
5862306a36Sopenharmony_ci	However this is a more accurate and less workload-dependent measure
5962306a36Sopenharmony_ci	of how much CPU load is being placed on the sunrpc server layer
6062306a36Sopenharmony_ci	due to NFS network traffic.
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_cisockets-enqueued
6362306a36Sopenharmony_ci	Counts how many times an NFS transport is enqueued to wait for
6462306a36Sopenharmony_ci	an nfsd thread to service it, i.e. no nfsd thread was considered
6562306a36Sopenharmony_ci	available.
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci	The circumstance this statistic tracks indicates that there was NFS
6862306a36Sopenharmony_ci	network-facing work to be done but it couldn't be done immediately,
6962306a36Sopenharmony_ci	thus introducing a small delay in servicing NFS calls.  The ideal
7062306a36Sopenharmony_ci	rate of change for this counter is zero; significantly non-zero
7162306a36Sopenharmony_ci	values may indicate a performance limitation.
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci	This can happen because there are too few nfsd threads in the thread
7462306a36Sopenharmony_ci	pool for the NFS workload (the workload is thread-limited), in which
7562306a36Sopenharmony_ci	case configuring more nfsd threads will probably improve the
7662306a36Sopenharmony_ci	performance of the NFS workload.
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_cithreads-woken
7962306a36Sopenharmony_ci	Counts how many times an idle nfsd thread is woken to try to
8062306a36Sopenharmony_ci	receive some data from an NFS transport.
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci	This statistic tracks the circumstance where incoming
8362306a36Sopenharmony_ci	network-facing NFS work is being handled quickly, which is a good
8462306a36Sopenharmony_ci	thing.  The ideal rate of change for this counter will be close
8562306a36Sopenharmony_ci	to but less than the rate of change of the packets-arrived counter.
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_cithreads-timedout
8862306a36Sopenharmony_ci	Counts how many times an nfsd thread triggered an idle timeout,
8962306a36Sopenharmony_ci	i.e. was not woken to handle any incoming network packets for
9062306a36Sopenharmony_ci	some time.
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci	This statistic counts a circumstance where there are more nfsd
9362306a36Sopenharmony_ci	threads configured than can be used by the NFS workload.  This is
9462306a36Sopenharmony_ci	a clue that the number of nfsd threads can be reduced without
9562306a36Sopenharmony_ci	affecting performance.  Unfortunately, it's only a clue and not
9662306a36Sopenharmony_ci	a strong indication, for a couple of reasons:
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci	 - Currently the rate at which the counter is incremented is quite
9962306a36Sopenharmony_ci	   slow; the idle timeout is 60 minutes.  Unless the NFS workload
10062306a36Sopenharmony_ci	   remains constant for hours at a time, this counter is unlikely
10162306a36Sopenharmony_ci	   to be providing information that is still useful.
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci	 - It is usually a wise policy to provide some slack,
10462306a36Sopenharmony_ci	   i.e. configure a few more nfsds than are currently needed,
10562306a36Sopenharmony_ci	   to allow for future spikes in load.
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ciNote that incoming packets on NFS transports will be dealt with in
10962306a36Sopenharmony_cione of three ways.  An nfsd thread can be woken (threads-woken counts
11062306a36Sopenharmony_cithis case), or the transport can be enqueued for later attention
11162306a36Sopenharmony_ci(sockets-enqueued counts this case), or the packet can be temporarily
11262306a36Sopenharmony_cideferred because the transport is currently being used by an nfsd
11362306a36Sopenharmony_cithread.  This last case is not very interesting and is not explicitly
11462306a36Sopenharmony_cicounted, but can be inferred from the other counters thus::
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci	packets-deferred = packets-arrived - ( sockets-enqueued + threads-woken )
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ciMore
12062306a36Sopenharmony_ci====
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ciDescriptions of the other statistics file should go here.
123