Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How do I accurately observe and measure the amount of virtual memory utilization and activity on Linux? I know there is vmstat, but how do I interpret the results? Or, what is better?

share|improve this question
add comment

5 Answers

up vote 7 down vote accepted

"vmstat" will tell you what you want to know. The "si" and "so" columns are showing you the amount of memory swapped in / out per interval. Both "vmstat" and "free" can show you the breakdown of memory usage. Rather than copy and paste the text, my answer here gives you some background into what those tools report.

share|improve this answer
    
perfect. I should have searched for vmstat. Thanks! –  randy melder Oct 23 '09 at 2:51
add comment

If the thrashing is caused by swapping then this line gives a good number:

vmstat 10 2 | tail -n1 | awk  '{print $7*$8}'

If the computer is swapping out, it may be OK. If the computer is swapping in, that may be OK, too. But if the computer is both swapping in and swapping out then it is bad.

share|improve this answer
add comment

One of the great linux dilemmas is knowing which tool to use. I guess that's one of the reasons I wrote collectl over 5 years ago. It combines the best of most other tools to combine just about all other them into one. In fact, it provides alternate formats of output so if you like vmstat output you just run "collectl --vmstat". So why not just run vmstat? Thats easy - collectl can also record data like sar but play it back to look like vmstat! It will even play it back in a format which you can directly feed to gnuplot (see collectl-utils) or you can load it into exel or even RRD if you want to go that route.

-mark

share|improve this answer
add comment

Another useful tool is atop, which gives more detailed views of I/O than plain old top.

share|improve this answer
add comment

Have you gone thru the manpage?

man vmstat

If you need historical information, I use kSar. It has the additional useful ability that it can be run on a remote machine and gather information directly via ssh.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.