xref: /linux/Documentation/filesystems/nfs/knfsd-stats.rst (revision ead5d1f4d877e92c051e1a1ade623d0d30e71619)
1*cb63032bSDaniel W. S. Almeida============================
2*cb63032bSDaniel W. S. AlmeidaKernel NFS Server Statistics
3*cb63032bSDaniel W. S. Almeida============================
4*cb63032bSDaniel W. S. Almeida
5*cb63032bSDaniel W. S. Almeida:Authors: Greg Banks <gnb@sgi.com> - 26 Mar 2009
6*cb63032bSDaniel W. S. Almeida
7*cb63032bSDaniel W. S. AlmeidaThis document describes the format and semantics of the statistics
8*cb63032bSDaniel W. S. Almeidawhich the kernel NFS server makes available to userspace.  These
9*cb63032bSDaniel W. S. Almeidastatistics are available in several text form pseudo files, each of
10*cb63032bSDaniel W. S. Almeidawhich is described separately below.
11*cb63032bSDaniel W. S. Almeida
12*cb63032bSDaniel W. S. AlmeidaIn most cases you don't need to know these formats, as the nfsstat(8)
13*cb63032bSDaniel W. S. Almeidaprogram from the nfs-utils distribution provides a helpful command-line
14*cb63032bSDaniel W. S. Almeidainterface for extracting and printing them.
15*cb63032bSDaniel W. S. Almeida
16*cb63032bSDaniel W. S. AlmeidaAll the files described here are formatted as a sequence of text lines,
17*cb63032bSDaniel W. S. Almeidaseparated by newline '\n' characters.  Lines beginning with a hash
18*cb63032bSDaniel W. S. Almeida'#' character are comments intended for humans and should be ignored
19*cb63032bSDaniel W. S. Almeidaby parsing routines.  All other lines contain a sequence of fields
20*cb63032bSDaniel W. S. Almeidaseparated by whitespace.
21*cb63032bSDaniel W. S. Almeida
22*cb63032bSDaniel W. S. Almeida/proc/fs/nfsd/pool_stats
23*cb63032bSDaniel W. S. Almeida========================
24*cb63032bSDaniel W. S. Almeida
25*cb63032bSDaniel W. S. AlmeidaThis file is available in kernels from 2.6.30 onwards, if the
26*cb63032bSDaniel W. S. Almeida/proc/fs/nfsd filesystem is mounted (it almost always should be).
27*cb63032bSDaniel W. S. Almeida
28*cb63032bSDaniel W. S. AlmeidaThe first line is a comment which describes the fields present in
29*cb63032bSDaniel W. S. Almeidaall the other lines.  The other lines present the following data as
30*cb63032bSDaniel W. S. Almeidaa sequence of unsigned decimal numeric fields.  One line is shown
31*cb63032bSDaniel W. S. Almeidafor each NFS thread pool.
32*cb63032bSDaniel W. S. Almeida
33*cb63032bSDaniel W. S. AlmeidaAll counters are 64 bits wide and wrap naturally.  There is no way
34*cb63032bSDaniel W. S. Almeidato zero these counters, instead applications should do their own
35*cb63032bSDaniel W. S. Almeidarate conversion.
36*cb63032bSDaniel W. S. Almeida
37*cb63032bSDaniel W. S. Almeidapool
38*cb63032bSDaniel W. S. Almeida	The id number of the NFS thread pool to which this line applies.
39*cb63032bSDaniel W. S. Almeida	This number does not change.
40*cb63032bSDaniel W. S. Almeida
41*cb63032bSDaniel W. S. Almeida	Thread pool ids are a contiguous set of small integers starting
42*cb63032bSDaniel W. S. Almeida	at zero.  The maximum value depends on the thread pool mode, but
43*cb63032bSDaniel W. S. Almeida	currently cannot be larger than the number of CPUs in the system.
44*cb63032bSDaniel W. S. Almeida	Note that in the default case there will be a single thread pool
45*cb63032bSDaniel W. S. Almeida	which contains all the nfsd threads and all the CPUs in the system,
46*cb63032bSDaniel W. S. Almeida	and thus this file will have a single line with a pool id of "0".
47*cb63032bSDaniel W. S. Almeida
48*cb63032bSDaniel W. S. Almeidapackets-arrived
49*cb63032bSDaniel W. S. Almeida	Counts how many NFS packets have arrived.  More precisely, this
50*cb63032bSDaniel W. S. Almeida	is the number of times that the network stack has notified the
51*cb63032bSDaniel W. S. Almeida	sunrpc server layer that new data may be available on a transport
52*cb63032bSDaniel W. S. Almeida	(e.g. an NFS or UDP socket or an NFS/RDMA endpoint).
53*cb63032bSDaniel W. S. Almeida
54*cb63032bSDaniel W. S. Almeida	Depending on the NFS workload patterns and various network stack
55*cb63032bSDaniel W. S. Almeida	effects (such as Large Receive Offload) which can combine packets
56*cb63032bSDaniel W. S. Almeida	on the wire, this may be either more or less than the number
57*cb63032bSDaniel W. S. Almeida	of NFS calls received (which statistic is available elsewhere).
58*cb63032bSDaniel W. S. Almeida	However this is a more accurate and less workload-dependent measure
59*cb63032bSDaniel W. S. Almeida	of how much CPU load is being placed on the sunrpc server layer
60*cb63032bSDaniel W. S. Almeida	due to NFS network traffic.
61*cb63032bSDaniel W. S. Almeida
62*cb63032bSDaniel W. S. Almeidasockets-enqueued
63*cb63032bSDaniel W. S. Almeida	Counts how many times an NFS transport is enqueued to wait for
64*cb63032bSDaniel W. S. Almeida	an nfsd thread to service it, i.e. no nfsd thread was considered
65*cb63032bSDaniel W. S. Almeida	available.
66*cb63032bSDaniel W. S. Almeida
67*cb63032bSDaniel W. S. Almeida	The circumstance this statistic tracks indicates that there was NFS
68*cb63032bSDaniel W. S. Almeida	network-facing work to be done but it couldn't be done immediately,
69*cb63032bSDaniel W. S. Almeida	thus introducing a small delay in servicing NFS calls.  The ideal
70*cb63032bSDaniel W. S. Almeida	rate of change for this counter is zero; significantly non-zero
71*cb63032bSDaniel W. S. Almeida	values may indicate a performance limitation.
72*cb63032bSDaniel W. S. Almeida
73*cb63032bSDaniel W. S. Almeida	This can happen because there are too few nfsd threads in the thread
74*cb63032bSDaniel W. S. Almeida	pool for the NFS workload (the workload is thread-limited), in which
75*cb63032bSDaniel W. S. Almeida	case configuring more nfsd threads will probably improve the
76*cb63032bSDaniel W. S. Almeida	performance of the NFS workload.
77*cb63032bSDaniel W. S. Almeida
78*cb63032bSDaniel W. S. Almeidathreads-woken
79*cb63032bSDaniel W. S. Almeida	Counts how many times an idle nfsd thread is woken to try to
80*cb63032bSDaniel W. S. Almeida	receive some data from an NFS transport.
81*cb63032bSDaniel W. S. Almeida
82*cb63032bSDaniel W. S. Almeida	This statistic tracks the circumstance where incoming
83*cb63032bSDaniel W. S. Almeida	network-facing NFS work is being handled quickly, which is a good
84*cb63032bSDaniel W. S. Almeida	thing.  The ideal rate of change for this counter will be close
85*cb63032bSDaniel W. S. Almeida	to but less than the rate of change of the packets-arrived counter.
86*cb63032bSDaniel W. S. Almeida
87*cb63032bSDaniel W. S. Almeidathreads-timedout
88*cb63032bSDaniel W. S. Almeida	Counts how many times an nfsd thread triggered an idle timeout,
89*cb63032bSDaniel W. S. Almeida	i.e. was not woken to handle any incoming network packets for
90*cb63032bSDaniel W. S. Almeida	some time.
91*cb63032bSDaniel W. S. Almeida
92*cb63032bSDaniel W. S. Almeida	This statistic counts a circumstance where there are more nfsd
93*cb63032bSDaniel W. S. Almeida	threads configured than can be used by the NFS workload.  This is
94*cb63032bSDaniel W. S. Almeida	a clue that the number of nfsd threads can be reduced without
95*cb63032bSDaniel W. S. Almeida	affecting performance.  Unfortunately, it's only a clue and not
96*cb63032bSDaniel W. S. Almeida	a strong indication, for a couple of reasons:
97*cb63032bSDaniel W. S. Almeida
98*cb63032bSDaniel W. S. Almeida	 - Currently the rate at which the counter is incremented is quite
99*cb63032bSDaniel W. S. Almeida	   slow; the idle timeout is 60 minutes.  Unless the NFS workload
100*cb63032bSDaniel W. S. Almeida	   remains constant for hours at a time, this counter is unlikely
101*cb63032bSDaniel W. S. Almeida	   to be providing information that is still useful.
102*cb63032bSDaniel W. S. Almeida
103*cb63032bSDaniel W. S. Almeida	 - It is usually a wise policy to provide some slack,
104*cb63032bSDaniel W. S. Almeida	   i.e. configure a few more nfsds than are currently needed,
105*cb63032bSDaniel W. S. Almeida	   to allow for future spikes in load.
106*cb63032bSDaniel W. S. Almeida
107*cb63032bSDaniel W. S. Almeida
108*cb63032bSDaniel W. S. AlmeidaNote that incoming packets on NFS transports will be dealt with in
109*cb63032bSDaniel W. S. Almeidaone of three ways.  An nfsd thread can be woken (threads-woken counts
110*cb63032bSDaniel W. S. Almeidathis case), or the transport can be enqueued for later attention
111*cb63032bSDaniel W. S. Almeida(sockets-enqueued counts this case), or the packet can be temporarily
112*cb63032bSDaniel W. S. Almeidadeferred because the transport is currently being used by an nfsd
113*cb63032bSDaniel W. S. Almeidathread.  This last case is not very interesting and is not explicitly
114*cb63032bSDaniel W. S. Almeidacounted, but can be inferred from the other counters thus::
115*cb63032bSDaniel W. S. Almeida
116*cb63032bSDaniel W. S. Almeida	packets-deferred = packets-arrived - ( sockets-enqueued + threads-woken )
117*cb63032bSDaniel W. S. Almeida
118*cb63032bSDaniel W. S. Almeida
119*cb63032bSDaniel W. S. AlmeidaMore
120*cb63032bSDaniel W. S. Almeida====
121*cb63032bSDaniel W. S. Almeida
122*cb63032bSDaniel W. S. AlmeidaDescriptions of the other statistics file should go here.
123