The nfsstat -s command
The NFS server displays the number of NFS calls received, calls, and rejected, badcalls, due to authentication as well as the counts and percentages for the various kinds of calls made.
# nfsstat -s
Server rpc:
Connection oriented:
calls badcalls nullrecv badlen xdrcall dupchecks dupreqs
15835 0 0 0 0 772 0
Connectionless:
calls badcalls nullrecv badlen xdrcall dupchecks dupreqs
0 0 0 0 0 0 0
Server nfs:
calls badcalls public_v2 public_v3
15835 0 0 0
Version 2: (0 calls)
null getattr setattr root lookup readlink read
0 0% 0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
wrcache write create remove rename link symlink
0 0% 0 0% 0 0% 0 0% 0 0% 0 0% 0 0%
mkdir rmdir readdir statfs
0 0% 0 0% 0 0% 0 0%
Version 3: (15835 calls)
null getattr setattr lookup access readlink read
7 0% 3033 19% 55 0% 1008 6% 1542 9% 20 0% 9000 56%
write create mkdir symlink mknod remove rmdir
175 1% 185 1% 0 0% 0 0% 0 0% 120 0% 0 0%
rename link readdir readdir+ fsstat fsinfo pathconf
87 0% 0 0% 1 0% 150 0% 348 2% 7 0% 0 0%
commit
97 0%
RPC output for the server, -s, is as follows:
- calls
- Total number of RPC calls received from clients
- badcalls
- Total number of calls rejected by the RPC layer
- nullrecv
- Number of times an RPC call was not available when it was thought to be received
- badlen
- Packets truncated or damaged (number of RPC calls with a length shorter than a minimum-sized RPC call)
- xdrcall
- Number of RPC calls whose header could not be External Data Representation (XDR) decoded
- dupchecks
- Number of RPC calls looked up in the duplicate request cache
- dupreqs
- Number of duplicate RPC calls found
The output also displays a count of the various kinds of calls and their respective percentages.
Duplicate checks are performed for operations that cannot be performed twice with the same result. The classic example is the rm command. The first rm command will succeed, but if the reply is lost, the client will retransmit it. We want duplicate requests like these to succeed, so the duplicate cache is consulted, and if it is a duplicate request, the same (successful) result is returned on the duplicate request as was generated on the initial request.
By looking at the percentage of calls for different types of operations, such as getattr(), read(), write(), or readdir(), you can decide what type of tuning to use. For example, if the percentage of getattr() calls is very high, then tuning attribute caches may be advantageous. If the percentage of write() calls is very high, then disk and LVM tuning is important. If the percentage of read() calls is very high, then using more RAM for caching files could improve performance.