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