nfsslower(8)

โœจ NFSSLOWER(8) โœจ

Heyy bestie, welcome to the nfsslower(8) page from the System Manager's Manual ๐Ÿ’– It's the one for tracing slow NFS file ops ๐Ÿฆ‹


๐Ÿ” NAME ๐Ÿ”

nfsslower - Trace slow NFS file operations, with per-event details ๐Ÿงš

๐Ÿ“ SYNOPSIS ๐Ÿ“

nfsslower [-h] [-j] [-p PID] [min_ms]

๐Ÿ’… DESCRIPTION ๐Ÿ’…

Okay so this tool traces the common NFSv3 & NFSv4 file operations: reads, writes, opens, and getattrs โœจ It measures how long each one takes and prints details for every single one that went over a threshold. Main character energy ๐Ÿ‘‘

WARNING: Please go read the OVERHEAD section before you run this ๐Ÿ™ˆ

By default the minimum millisecond threshold is 10, so anything 10 ms or slower gets printed. If you set the threshold to 0, every event gets printed. Warning: that is extremely verbose ๐Ÿ˜ญ

Real talk, this works by tracing the nfs_file_operations interface functions, so it'll need updating to match any changes to those functions ๐Ÿ”ง

It uses kprobes to instrument the kernel for entry and exit info. In the future, the preferred way would be tracepoints ๐ŸŒˆ Right now though, there aren't any tracepoints for nfs_read_file, nfs_write_file and nfs_open_file. nfs_getattr does have entry and exit tracepoints, but we chose kprobes for consistency ๐Ÿคทโ€โ™€๏ธ

Since this uses BPF, only the root user can use this tool ๐Ÿ”

๐Ÿงฐ REQUIREMENTS ๐Ÿงฐ

CONFIG_BPF and bcc.

๐ŸŽ€ OPTIONS ๐ŸŽ€

  • -p PID โ€” Only trace this PID ๐ŸŽฏ
  • -j โ€” Output the trace in CSV format, so it's easy to parse ๐Ÿ“Š
  • min_ms โ€” The minimum I/O latency (duration) to trace, in milliseconds. The default is 10 ms โฑ๏ธ

๐ŸŒธ EXAMPLES ๐ŸŒธ

Trace synchronous file reads and writes slower than 10 ms:

# nfsslower

Trace slower than 1 ms:

# nfsslower 1

Trace slower than 1 ms, and output just the fields in parsable format (CSV):

# nfsslower -j 1

Trace all file reads and writes (warning: the output will be verbose):

# nfsslower 0

Trace slower than 1 ms, for PID 181 only:

# nfsslower -p 181 1

๐Ÿ“ FIELDS ๐Ÿ“

  • TIME(s) โ€” When the I/O completed, in seconds, counted from the first I/O seen โฐ
  • COMM โ€” The process name ๐Ÿง‘โ€๐Ÿ’ป
  • PID โ€” The process ID ๐Ÿ†”
  • T โ€” The type of operation. R == read, W == write, O == open, G == getattr ๐Ÿ”ค
  • OFF_KB โ€” The file offset for the I/O, in Kbytes ๐Ÿ“
  • BYTES โ€” The size of the I/O, in bytes ๐Ÿ“ฆ
  • LAT(ms) โ€” The latency (duration) of the I/O. It's measured from when VFS issued it to the filesystem, until it completed. This time includes RPC latency, network latency, cache lookup, remote fileserver processing latency, and so on. It's a more accurate measure of the latency apps actually suffer when doing NFS read/write calls to a fileserver ๐Ÿ’ฏ
  • FILENAME โ€” A cached kernel file name (it comes from dentry->d_name.name) ๐Ÿ“
  • ENDTIME_us โ€” The completion timestamp, in microseconds (-j only) ๐Ÿ•’
  • OFFSET_b โ€” The file offset, in bytes (-j only) ๐Ÿงฎ
  • LATENCY_us โ€” The latency (duration) of the I/O, in microseconds (-j only) โšก

๐Ÿซง OVERHEAD ๐Ÿซง

Heads up, this adds low-overhead instrumentation to NFS operations, including reads and writes from the file system cache ๐Ÿ™ˆ Reads, writes, and especially getattrs can be super frequent (depending on the workload, e.g. 1M/sec). At that point, the overhead of this tool can start to get significant, even if it prints no "slower" events at all ๐Ÿ˜ฌ Measure and quantify before you use it. If this keeps being a problem, consider switching to a tool that only prints in-kernel summaries. This tool has been tested with NFSv3 & NFSv4, but it might work with NFSv{1,2}, since it traces the generic functions from nfs_file_operations.

Note: this tool's overhead should be lower than fileslower(8), because it only targets NFS functions and not all the file read/write paths ๐Ÿ’œ

๐ŸŒ SOURCE ๐ŸŒ

This is from bcc ๐Ÿ

https://github.com/iovisor/bcc

Also look in the bcc distribution for a companion nfsslower_examples.txt file. It has example usage, output, and commentary for this tool ๐Ÿ“–

๐Ÿ’ป OS ๐Ÿ’ป

Linux ๐Ÿง

๐Ÿšง STABILITY ๐Ÿšง

Unstable, it's still in development ๐Ÿ› ๏ธ

๐Ÿ‘ฉโ€๐Ÿ’ป AUTHOR ๐Ÿ‘ฉโ€๐Ÿ’ป

Samuel Nair ๐Ÿซถ

๐Ÿ”— SEE ALSO ๐Ÿ”—

biosnoop(8), funccount(8), fileslower(8) โœจ


Bestie, that's the whole page ๐ŸŽ€ This one is from the USER COMMANDS section, last dated 2017-09-01, so go show your nfsslower(8) skills ๐Ÿ’–๐Ÿฆ‹๐ŸŒˆ