readahead(8)

πŸ“¦
version 0.36.1 Β· 3 versions
, in alpine 3.24, nixpkgs unstable

πŸ’… readahead(8) β€” like, the manual page, but make it cute ✨

Okay bestie, so readahead is this icon in the System Manager's Manual and she is literally here to show you the performance of your read-ahead cache. No cap, she's serving main character energy for your kernel. πŸŽ€


🌸 NAME 🌸

readahead β€” literally shows you the performance of the read-ahead cache, periodt.


✨ SYNOPSIS ✨

readahead [-d DURATION]

πŸ¦‹ DESCRIPTION πŸ¦‹

So the way this works: readahead shows you how the read-ahead caching is doing on your system under a given load, so you can investigate any caching issues you're lowkey stressed about. It shows a count of unused pages in the cache and also prints a histogram showing how long they've been chilling there. Obsessed. πŸ’–

This tool traces the __do_page_cache_readahead() kernel function to track entry and exit in the readahead mechanism in the kernel, and then uses __page_cache_alloc() and mark_page_accessed() functions to calculate the age of the page in the cache and see how many are left unaccessed. It's giving ✨ forensic vibes ✨.

🚨 Since this uses BPF, only the root user can use this tool. Sorry bestie, no root no slay. πŸ”₯

πŸ’€ NOTE ON KPROBES USAGE πŸ’€

Since the tool uses Kprobes, depending on your linux kernel's compilation, these functions may be inlined and hence not available for Kprobes. 😭 To see whether you have the functions available, check vmlinux source and binary to confirm whether inlining is happening or not. You can also check /proc/kallsyms on the host and verify if the target functions are present there before using this. Do your vibe check first, bestie, don't just run it blind. πŸ™ˆ


πŸ’œ REQUIREMENTS πŸ’œ

  • CONFIG_BPF
  • bcc

That's it, that's the list. Iconic. πŸ‘‘


🌈 OPTIONS 🌈

  • -h β€” prints the usage message, like a little friendly reminder. 🫢
  • -d DURATION β€” traces the read-ahead caching system for DURATION seconds. Time it like a reel. ⏱️

πŸ“ EXAMPLES πŸ“

Trace for 30 seconds and show histogram of page age (ms) in read-ahead cache along with unused page count:

# readahead -d 30

Literally that simple. Ate. πŸ’…


πŸ”₯ OVERHEAD πŸ”₯

The kernel functions instrumented by this program could be high-frequency depending on the profile of the application (for example sequential IO). We advise the users to measure and monitor the overhead before leaving this turned on in production environments. πŸ’€

Translation: measure first, bestie. Don't just leave it running in prod and hope for the best. That's not the move. 🚫


🧚 SOURCE 🧚

This originated as a bpftrace tool from the book "BPF Performance Tools", published by Addison Wesley (2019):

http://www.brendangregg.com/bpf-performance-tools-book.html

See the book for more documentation on this tool. It's giving required reading. πŸ“š

This version is in the BCC repository:

https://github.com/iovisor/bcc

Also look in the bcc distribution for a companion _examples.txt file containing example usage, output, and commentary for this tool. Go look, it's cute. 🌸


🌟 OS 🌟

Linux. Obviously. 🐧


⭐ STABILITY ⭐

Unstable β€” in development. She's a work in progress, and honestly? Same. 🫢


πŸ‘‘ AUTHOR πŸ‘‘

Suchakra Sharma. Respect the icon who built her. πŸ™Œ


πŸŽ€ SEE ALSO πŸŽ€

Go read those too, iykyk. πŸ’–


And that's the whole page, bestie! 🌈 Shoutout to the BCC crew and the USER COMMANDS source, dated 2020-08-20 β€” mwah! πŸ’‹ No cap, you're now fully educated on readahead. Slay. ✨

πŸ“¦ where this page comes from