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.

I want to write a script that will kill my processes when my machine is doing "too much" swapping of process memory from disk to memory.
What is the best way to determine that? I saw top has %wa and iostat has iowait data. vmstat has swap in and swap out.
Can that be used as a metric? What is the best for me? can someone recommend something else?

share|improve this question
add comment

1 Answer

Several methods and you have described them yourself.

First, top - see the cpu load and where the load is. If most of the CPU time is burning at %sys, it is some kind of system activity. Check the memory usage also, if most of the memory is in swapped state, then a continuous high cpu %sys means thrashing situation.

Next, vmstat. you know the fields to monitor.

For historical data, use sar. Again, see the column where cpu time is being burnt.

mpstat will also show the cpu usage condition.

To sum up, lots of tools are there and you can easily filter out specific field you need with some awk, cut, sort.

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.