···11+22+Kernel NFS Server Statistics33+============================44+55+This document describes the format and semantics of the statistics66+which the kernel NFS server makes available to userspace. These77+statistics are available in several text form pseudo files, each of88+which is described separately below.99+1010+In most cases you don't need to know these formats, as the nfsstat(8)1111+program from the nfs-utils distribution provides a helpful command-line1212+interface for extracting and printing them.1313+1414+All the files described here are formatted as a sequence of text lines,1515+separated by newline '\n' characters. Lines beginning with a hash1616+'#' character are comments intended for humans and should be ignored1717+by parsing routines. All other lines contain a sequence of fields1818+separated by whitespace.1919+2020+/proc/fs/nfsd/pool_stats2121+------------------------2222+2323+This file is available in kernels from 2.6.30 onwards, if the2424+/proc/fs/nfsd filesystem is mounted (it almost always should be).2525+2626+The first line is a comment which describes the fields present in2727+all the other lines. The other lines present the following data as2828+a sequence of unsigned decimal numeric fields. One line is shown2929+for each NFS thread pool.3030+3131+All counters are 64 bits wide and wrap naturally. There is no way3232+to zero these counters, instead applications should do their own3333+rate conversion.3434+3535+pool3636+ The id number of the NFS thread pool to which this line applies.3737+ This number does not change.3838+3939+ Thread pool ids are a contiguous set of small integers starting4040+ at zero. The maximum value depends on the thread pool mode, but4141+ currently cannot be larger than the number of CPUs in the system.4242+ Note that in the default case there will be a single thread pool4343+ which contains all the nfsd threads and all the CPUs in the system,4444+ and thus this file will have a single line with a pool id of "0".4545+4646+packets-arrived4747+ Counts how many NFS packets have arrived. More precisely, this4848+ is the number of times that the network stack has notified the4949+ sunrpc server layer that new data may be available on a transport5050+ (e.g. an NFS or UDP socket or an NFS/RDMA endpoint).5151+5252+ Depending on the NFS workload patterns and various network stack5353+ effects (such as Large Receive Offload) which can combine packets5454+ on the wire, this may be either more or less than the number5555+ of NFS calls received (which statistic is available elsewhere).5656+ However this is a more accurate and less workload-dependent measure5757+ of how much CPU load is being placed on the sunrpc server layer5858+ due to NFS network traffic.5959+6060+sockets-enqueued6161+ Counts how many times an NFS transport is enqueued to wait for6262+ an nfsd thread to service it, i.e. no nfsd thread was considered6363+ available.6464+6565+ The circumstance this statistic tracks indicates that there was NFS6666+ network-facing work to be done but it couldn't be done immediately,6767+ thus introducing a small delay in servicing NFS calls. The ideal6868+ rate of change for this counter is zero; significantly non-zero6969+ values may indicate a performance limitation.7070+7171+ This can happen either because there are too few nfsd threads in the7272+ thread pool for the NFS workload (the workload is thread-limited),7373+ or because the NFS workload needs more CPU time than is available in7474+ the thread pool (the workload is CPU-limited). In the former case,7575+ configuring more nfsd threads will probably improve the performance7676+ of the NFS workload. In the latter case, the sunrpc server layer is7777+ already choosing not to wake idle nfsd threads because there are too7878+ many nfsd threads which want to run but cannot, so configuring more7979+ nfsd threads will make no difference whatsoever. The overloads-avoided8080+ statistic (see below) can be used to distinguish these cases.8181+8282+threads-woken8383+ Counts how many times an idle nfsd thread is woken to try to8484+ receive some data from an NFS transport.8585+8686+ This statistic tracks the circumstance where incoming8787+ network-facing NFS work is being handled quickly, which is a good8888+ thing. The ideal rate of change for this counter will be close8989+ to but less than the rate of change of the packets-arrived counter.9090+9191+overloads-avoided9292+ Counts how many times the sunrpc server layer chose not to wake an9393+ nfsd thread, despite the presence of idle nfsd threads, because9494+ too many nfsd threads had been recently woken but could not get9595+ enough CPU time to actually run.9696+9797+ This statistic counts a circumstance where the sunrpc layer9898+ heuristically avoids overloading the CPU scheduler with too many9999+ runnable nfsd threads. The ideal rate of change for this counter100100+ is zero. Significant non-zero values indicate that the workload101101+ is CPU limited. Usually this is associated with heavy CPU usage102102+ on all the CPUs in the nfsd thread pool.103103+104104+ If a sustained large overloads-avoided rate is detected on a pool,105105+ the top(1) utility should be used to check for the following106106+ pattern of CPU usage on all the CPUs associated with the given107107+ nfsd thread pool.108108+109109+ - %us ~= 0 (as you're *NOT* running applications on your NFS server)110110+111111+ - %wa ~= 0112112+113113+ - %id ~= 0114114+115115+ - %sy + %hi + %si ~= 100116116+117117+ If this pattern is seen, configuring more nfsd threads will *not*118118+ improve the performance of the workload. If this patten is not119119+ seen, then something more subtle is wrong.120120+121121+threads-timedout122122+ Counts how many times an nfsd thread triggered an idle timeout,123123+ i.e. was not woken to handle any incoming network packets for124124+ some time.125125+126126+ This statistic counts a circumstance where there are more nfsd127127+ threads configured than can be used by the NFS workload. This is128128+ a clue that the number of nfsd threads can be reduced without129129+ affecting performance. Unfortunately, it's only a clue and not130130+ a strong indication, for a couple of reasons:131131+132132+ - Currently the rate at which the counter is incremented is quite133133+ slow; the idle timeout is 60 minutes. Unless the NFS workload134134+ remains constant for hours at a time, this counter is unlikely135135+ to be providing information that is still useful.136136+137137+ - It is usually a wise policy to provide some slack,138138+ i.e. configure a few more nfsds than are currently needed,139139+ to allow for future spikes in load.140140+141141+142142+Note that incoming packets on NFS transports will be dealt with in143143+one of three ways. An nfsd thread can be woken (threads-woken counts144144+this case), or the transport can be enqueued for later attention145145+(sockets-enqueued counts this case), or the packet can be temporarily146146+deferred because the transport is currently being used by an nfsd147147+thread. This last case is not very interesting and is not explicitly148148+counted, but can be inferred from the other counters thus:149149+150150+packets-deferred = packets-arrived - ( sockets-enqueued + threads-woken )151151+152152+153153+More154154+----155155+Descriptions of the other statistics file should go here.156156+157157+158158+Greg Banks <gnb@sgi.com>159159+26 Mar 2009