zfsslower(8)

๐Ÿ“ฆ version 0.36.1, in alpine 3.24, nixpkgs unstable, opensuse-leap 16.0

๐Ÿงš zfsslower(8) ๐Ÿงš

โœจ NAME โœจ

okay so the name is zfsslower ๐Ÿ’– and it's basically a tracer for slow ZFS file operations, with per-event details. literally the tool you want when your files are being sus and slow ๐Ÿซถ

๐Ÿ’… SYNOPSIS ๐Ÿ’…

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

๐ŸŒธ DESCRIPTION ๐ŸŒธ

okay bestie, this tool watches the common ZFS file ops: reads, writes, opens, and syncs ๐Ÿ“‚. It times each one and prints the details for any that go over a threshold. no cap, it's giving detective โœจ

WARNING: See the OVERHEAD section. (seriously, read it ๐Ÿ˜ญ)

By default the threshold is 10 milliseconds ๐ŸŽ€. If you set it to 0, every single event gets printed. that's giving chaos and also a LOT of output, so be warned ๐Ÿ’€

This uses kernel dynamic tracing of the ZPL interface (ZFS POSIX Layer) ๐Ÿ”ฅ. Because it hooks into that interface, it'll need updates if the interface ever changes. not me being dramatic, it's just how it works ๐Ÿ™ˆ

This is meant for the ZFS on Linux project: http://zfsonlinux.org ๐ŸŒˆ

And since it runs on BPF, only the root user can use it ๐Ÿ‘‘. sorry, not sorry ๐Ÿซถ

๐ŸŽ€ REQUIREMENTS ๐ŸŽ€

You'll need CONFIG_BPF and bcc ๐Ÿงš (no bcc, no tea)

โœจ OPTIONS โœจ

  • -p PID โ€” only trace this one PID ๐Ÿ’œ
  • min_ms โ€” the minimum I/O latency (duration) you want to trace, in milliseconds ๐Ÿ“. It defaults to 10 ms if you don't set it.

๐Ÿฆ‹ EXAMPLES ๐Ÿฆ‹

Trace synchronous file reads and writes that are slower than 10 ms:

# zfsslower

Trace anything slower than 1 ms:

# zfsslower 1

Trace slower than 1 ms, and print just the fields in parsable format (csv) ๐Ÿ“Š:

# zfsslower -j 1

Trace all file reads and writes (warning: the output is going to be extremely verbose ๐Ÿ˜ญ):

# zfsslower 0

Trace slower than 1 ms, for PID 181 only ๐ŸŽฏ:

# zfsslower -p 181 1

๐Ÿ”ฅ FIELDS ๐Ÿ”ฅ

  • TIME(s) โ€” when the I/O finished, counted in seconds from the first I/O it saw โฐ
  • COMM โ€” the process name ๐Ÿง‘โ€๐Ÿ’ป
  • PID โ€” the process ID ๐Ÿชช
  • T โ€” the type of operation. R is read, W is write, O is open, and S is fsync ๐Ÿ’…
  • 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, measured from when VFS issued it to the filesystem until it completed ๐Ÿ’€. This includes block device I/O, filesystem CPU cycles, filesystem locks, run queue latency, and so on. It's a more honest measure of what applications actually feel than timing things down at the block device layer, so it's the one to trust ๐Ÿซถ
  • 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 โš ๏ธ

okay this section is important, so read it slowly ๐Ÿ™ˆ

This adds low-overhead instrumentation to these ZFS operations, including reads and writes from the file system cache. Those reads and writes can be super frequent (it depends on the workload, eg, 1M/sec ๐Ÿ˜ณ). At that point, the tool's own overhead can start to get significant, even if it prints zero "slower" events. So measure and quantify before you use it ๐Ÿ“‰. If it's still a problem, consider switching to a tool that only prints in-kernel summaries ๐ŸงŠ.

The overhead here should be less than fileslower(8), since this tool only targets ZFS functions and not every file read/write path (which can include socket I/O) ๐Ÿฆ‹.

๐ŸŒˆ SOURCE ๐ŸŒˆ

This comes from bcc ๐Ÿ’œ:

https://github.com/iovisor/bcc

There's also a companion _examples.txt file in the bcc distribution with example usage, output, and commentary for this tool ๐Ÿ“–. go look, it's lowkey fire.

๐Ÿ“ OS ๐Ÿ“

Linux ๐Ÿง

๐Ÿงช STABILITY ๐Ÿงช

Unstable (it's still in development) ๐Ÿ™ˆ

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Brendan Gregg ๐Ÿซถ

๐Ÿ”— SEE ALSO ๐Ÿ”—

biosnoop(8), funccount(8), fileslower(8) ๐Ÿ’–


bestie, that's the whole thing ๐Ÿ’…โœจ this page is from the USER COMMANDS section, dated 2016-02-11, and the source is bcc ๐ŸŒธ. periodt ๐Ÿซถ๐Ÿ’œ