numastat(8)

๐Ÿ’– numastat(8) โ€” Administration ๐Ÿ’–

๐ŸŽ€ NAME ๐ŸŽ€

okay so numastat is the tool that shows you per-NUMA-node memory stats for processes AND the whole operating system ๐Ÿงš it's giving nerdy and I'm obsessed.

๐Ÿ“œ SYNTAX ๐Ÿ“œ

numastat

numastat [-V]

numastat [<PID>|<pattern>...]

numastat [-c] [-m] [-n] [-p <PID>|<pattern>] [-s[<node>]] [-v] [-z]
[<PID>|<pattern>...]

๐ŸŒธ DESCRIPTION ๐ŸŒธ

bestie, if you run numastat with no options or arguments at all, it shows you per-node NUMA hit and miss stats straight from the kernel memory allocator โœจ this default behavior is strictly compatible with the old long-standing numastat perl script written by Andi Kleen, so nothing gets weird. The default stats show per-node numbers (in units of pages of memory) across these categories:

  • numa_hit โ€” memory successfully allocated on this node like it was supposed to be ๐Ÿซถ
  • numa_miss โ€” memory allocated on this node even though the process preferred some other node ๐Ÿ™ˆ every numa_miss has a numa_foreign on another node.
  • numa_foreign โ€” memory meant for this node that actually got allocated somewhere else ๐Ÿ’€ every numa_foreign has a numa_miss on another node.
  • interleave_hit โ€” interleaved memory successfully allocated on this node, as intended ๐Ÿฆ‹
  • local_node โ€” memory allocated on this node while a process was literally running on it ๐Ÿ 
  • other_node โ€” memory allocated on this node while a process was running on some other node ๐ŸŒ

ngl, any options or arguments you add will totally change both the content AND the format of the display ๐Ÿ’… specified options switch the display units to megabytes of memory and change a bunch of other behaviors, as described below.

Memory usage info reflects the resident pages on the system ๐Ÿ‘‘

๐ŸŽ€ OPTIONS ๐ŸŽ€

  • -c โ€” minimizes the table width by dynamically shrinking the columns based on the data inside โœจ amounts of memory get rounded to the nearest megabyte (instead of the usual two decimal places). The column width and spacing can be a little unpredictable with this one, but the denser display is super useful on systems with lots of NUMA nodes ๐Ÿซง
  • -m โ€” shows the meminfo-like system-wide memory usage info ๐Ÿง  it's a per-node breakdown similar to what you'd find in /proc/meminfo.
  • -n โ€” shows the original numastat stats info. It shows the same stuff as the default behavior, but the units are megabytes of memory and there are other formatting and layout changes compared to the original numastat ๐ŸŽ€
  • -p <PID> or <pattern> โ€” shows per-node memory allocation info for the PID or pattern you give it ๐Ÿ” if the argument is only digits, it's treated as a numerical PID. If it has any non-digit characters, it's treated as a text fragment to search for in process command lines. For example, numastat -p qemu will find and show info for processes with "qemu" in the command line. Any command line arguments left over after option processing are treated as additional <PID> or <pattern> process specifiers, so the -p flag is actually optional: numastat qemu is equivalent to numastat -p qemu ๐Ÿงšโ€โ™€๏ธ
  • -s[<node>] โ€” sorts the table data in descending order before displaying it, so the biggest memory hogs show up first ๐Ÿ‘‘ with no <node> specified, the table gets sorted by the total column. If you add the optional <node>, the data gets sorted by that <node> column. Heads up: <node> has to come right after the -s with NO white space in between (e.g., numastat -s2) ๐Ÿ™ and because -s can take an optional argument, it must ALWAYS be the last option character in a compound option string.
โš ๏ธ main character warning: instead of numastat -msc (which probably won't work the way you expect), use numastat -mcs ๐Ÿ˜ญ
  • -v โ€” makes some reports more verbose ๐Ÿ“ฃ for multiple processes, it shows detailed info for each process. Normally, when per-node info for multiple processes is displayed, only the total lines appear.
  • -V โ€” displays the numastat version info and exits ๐Ÿท๏ธ
  • -z โ€” skips displaying table rows and columns that are only zero values ๐Ÿ™…โ€โ™€๏ธ this can cut down a ton of boring zero data on systems with lots of NUMA nodes. Just know that if zero rows or columns still show up with this option, there's probably at least one value in there that's actually non-zero but got rounded to zero for display ๐Ÿซ 

๐ŸŒˆ NOTES ๐ŸŒˆ

numastat tries to fold each table so it's easy to read in your output terminal ๐Ÿ“ฑ a terminal width of 80 characters is assumed by default. When the resize command is available, numastat tries to dynamically figure out and fine-tune the output tty width based on resize output. If the output isn't going to a tty, super long lines can show up depending on how many NUMA nodes are present. In every case, you can explicitly set the output width with the NUMASTAT_WIDTH environment variable, like NUMASTAT_WIDTH=100 numastat. On systems with tons of NUMA nodes, numastat -c -z .... can be a lifesaver for trimming the displayed info down ๐Ÿซถ

๐Ÿฆ‹ ENVIRONMENT VARIABLES ๐Ÿฆ‹

  • NUMASTAT_WIDTH โ€” sets the output width explicitly ๐ŸŽ€

๐Ÿ“ FILES ๐Ÿ“

  • /proc/*/numa_maps
  • /sys/devices/system/node/node*/meminfo
  • /sys/devices/system/node/node*/numastat

๐Ÿ“ EXAMPLES ๐Ÿ“

numastat -c -z -m -n
numastat -czs libvirt kvm qemu
watch -n1 numastat
watch -n1 --differences=cumulative numastat

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

The original numastat perl script was written circa 2003 by Andi Kleen <andi.kleen@intel.com>. The current numastat program was written in 2012 by Bill Gray <bgray@redhat.com> ๐Ÿ’œ it's compatible with the original by default, and it adds options to display per-node system memory usage and per-node process memory allocation. Iconic behavior, honestly.

๐Ÿ”— SEE ALSO ๐Ÿ”—

numactl(8), set_mempolicy(2), numa(3) โœจ


okay bestie, that's the whole numastat(8) tea ๐Ÿซถ written by Bill Gray, version 1.0.0, numastat(8) manual page, periodt ๐Ÿ’…๐ŸŒธ