ext4slower(8)

๐ŸŽ€ ext4slower(8) ๐ŸŽ€

System Manager's Manual ๐Ÿ’œ

โœจ NAME โœจ

okay so ext4slower is the tool that traces slow ext4 file operations and gives you per-event details ๐Ÿ” bestie, it's giving detective energy.

๐Ÿ’… SYNOPSIS ๐Ÿ’…

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

๐Ÿ“– DESCRIPTION ๐Ÿ“–

this tool keeps an eye on the common ext4 file operations: reads, writes, opens, and syncs ๐Ÿ‘€ it times each one and prints the details for any that go over a threshold. main character energy โœจ

๐Ÿšจ WARNING: see the OVERHEAD section. no cap, read it.

by default the minimum threshold is 10 milliseconds ๐Ÿ’– if you set it to 0, every single event gets printed (warning: verbose, we are not kidding ๐Ÿ™ˆ).

lowkey important: this works by tracing the ext4_file_operations interface functions, so it'll need updating whenever those functions change ๐Ÿ”ง

also, since this uses BPF, only the root user can run it ๐Ÿ‘‘

๐Ÿงฐ REQUIREMENTS ๐Ÿงฐ

you'll need CONFIG_BPF and bcc ๐ŸŒธ

๐ŸŽ€ OPTIONS ๐ŸŽ€

  • -p PID โ€” trace this PID only ๐Ÿฆ‹
  • 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:

# ext4slower

trace slower than 1 ms:

# ext4slower 1

trace slower than 1 ms, and output just the fields in parsable format (csv) ๐Ÿงš:

# ext4slower -j 1

trace all file reads and writes (warning: the output will be verbose ๐Ÿ™ˆ):

# ext4slower 0

trace slower than 1 ms, for PID 181 only ๐Ÿ’œ:

# ext4slower -p 181 1

๐Ÿ”ฅ FIELDS ๐Ÿ”ฅ

  • TIME(s) โ€” the time of I/O completion since the first I/O seen, in seconds โญ
  • COMM โ€” the process name ๐Ÿซถ
  • PID โ€” the process ID ๐Ÿ†”
  • T โ€” the type of operation. R == read, W == write, O == open, S == 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 time is inclusive of block device I/O, file system CPU cycles, file system locks, run queue latency, etc. it's a more accurate measure of the latency applications actually feel doing file system I/O, than measuring down at the block device interface ๐Ÿฅบโœจ
  • FILENAME โ€” a cached kernel file name (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 ๐Ÿข

โš ๏ธ this adds low-overhead instrumentation to these ext4 operations, including reads and writes from the file system cache. those reads and writes can be super frequent (depending on the workload; eg, 1M/sec), and at that point the overhead of this tool can start to get significant, even if it prints no "slower" events ๐Ÿ˜ญ measure and quantify before you use it. if it keeps being a problem, consider switching to a tool that only prints in-kernel summaries.

the overhead of this tool should be less than fileslower(8), though, because this one only targets ext4 functions and not every file read/write path (which can include socket I/O) ๐Ÿซถ

๐ŸŒธ SOURCE ๐ŸŒธ

this is from bcc ๐Ÿ’–

https://github.com/iovisor/bcc

also look in the bcc distribution for a companion _examples.txt file with example usage, output, and commentary for this tool ๐Ÿ“š

๐Ÿ’ป OS ๐Ÿ’ป

Linux ๐Ÿง

๐Ÿงช STABILITY ๐Ÿงช

Unstable - in development ๐Ÿšง

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

Brendan Gregg ๐Ÿ‘‘

๐Ÿ”— SEE ALSO ๐Ÿ”—

biosnoop(8), funccount(8), fileslower(8) ๐Ÿฆ‹


bestie, that's the whole tea โ˜•๐Ÿ’– this page is from the USER COMMANDS section, dated 2016-02-11, and sourced from bcc, so go forth and trace those slow ext4 ops ๐Ÿงšโœจ๐Ÿ’