finds.dev← search

// the find

brendangregg/wss

★ 240 · C · updated Aug 2021

Working Set Size tools

Three experimental Linux tools that estimate a process's working set size by checking which pages it touches over a short window. wss.pl is the fast Perl option and uses the referenced page flag. wss-v1 and wss-v2 use idle page tracking (Linux 4.3+), and v2 takes a system-wide snapshot so it can handle large processes. This is for people sizing memory on a Linux box who will accept the overhead and kernel risk the README describes.

The README runs the three tools against the same process and shows the timings side by side: wss-v2 returns in 0.8 seconds where wss-v1 takes 44.6 seconds for the same answer, which tells you when each one is worth running. wss-v2 avoids the referenced-flag approach that wss.pl depends on, using the safer idle page interface, and the snapshot design is what makes it usable on large processes. The warnings are specific: they give latency overhead figures, name the reclaim problem under swapping, and say where the kernel risk sits, so you can decide whether to run them without reading the code.

The last push was August 2021, and the README never says these were tested on a kernel newer than the ones they were written for, so treat it as a reference implementation and verify on your own kernel before trusting the numbers. wss.pl clears the referenced flag on every page of the process. The README admits this can confuse reclaim while the system is swapping, which is exactly when you most want a memory estimate, so it is the fastest of the three and the one to avoid on a production machine. wss-v1 walks pages one at a time and takes minutes on large processes, so it only works in practice for small ones, and wss-v2 still costs more than a second of CPU on big processes. There are no build instructions, no Makefile in the listing, and no tests, and the tools need root to read other processes' page data.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →