dannyman.toldme.com


FreeBSD, Technical

FAQ: How do you measure swap utilization in FreeBSD?

Q: How do you measure swap utilization in FreeBSD? (Assuming you are writing a script to gather performance metrics.)

A: If you are writing a C program, check kvm_getswapinfo(3) and maybe take a gander at the bottom of /usr/src/usr.bin/top/machine.c.

A: If you are writing a Perl script:

Measure swap activity:
sysctl vm.stats.vm.v_swapin vm.stats.vm.v_swapout vm.stats.vm.v_swappgsin vm.stats.vm.v_swappgsout
(I believe these results are COUNTER type values, like you get from netstat -inb. You could establish “swap activity” by plotting changes in this value.)

Measure swap size:

0-13:38 djh@mito ~> swapinfo
Device          1K-blocks     Used    Avail Capacity
/dev/ad0s1b       1022224        0  1022224     0%
0-13:38 djh@mito ~> swapctl -l
Device:       1024-blocks     Used:
/dev/ad0s1b     1022224         0

If you are trying to accomodate n+1 swap devices, try this:

0-13:44 djh@mito ~> swapctl -lsk
Device:       1024-blocks      Used:
/dev/ad0s1b      1022224          0
Total:           1022224          0

Read More

Next:
Previous:
Categories: FreeBSD, Technical

Discover more from dannyman.toldme.com

Subscribe now to keep reading and get access to the full archive.

Continue reading