Quote:
Originally Posted by
javanoob
1) I am seeing recommendations of doing vmstat with a large interval - why do we need do use a large interval ? How is that different from doing multiple counts with short intervals ?
.e.g. vmstat 10 2 vs vmstat 1 10 ?
vmstat 10 2 will monitor an interval of 20 seconds, whereas
vmstat 1 10 will only cover 10 seconds. Both are not sensible invocations for long-term monitoring. Try
vmstat 600 (every 10 minutes) or something like that. The reason why you want a long interval is that you are not interested in any "spike" but the average usage of a system. Further, every polling of the stats also places a (slight but non-zero) load onto the system. You don't want your monitoring system to create the bottleneck it is intended to prevent.
Quote:
Originally Posted by
javanoob
2) When there is a physical memory shortage, and memory need to be page out, will this piece of memory that is paged out will resides on the physical swap volume ?
Yes, correct
Quote:
Originally Posted by
javanoob
If so, why isn't swap -l an accurate way of saying if there is a memory shortage ?
You don't want to avoid
swap usage you want to avoid
swapping activity. Something being in the swap doesn't hurt - putting it there and getting it back into memory again is what hurts. Therefore looking at a number which only tells you how much swap is used doesn't tell you what you really want to know.
Quote:
Originally Posted by
javanoob
is it because sometimes paging unused memory out is healthy and necessary
Sometimes this is the case - it might be better overall if the damage you take by swapping something out is outweighed by the gain you may get from the memory freed that way which can be used otherwise. In general (but notice: "in general" doesn't mean "always") it makes sense to size a system in a way that swapping doesn't take place in normal operation. Swap is generally a "plan B", not the "plan A".
Quote:
Originally Posted by
javanoob
i3) However, can we also directly say, if my swap -l always display 'free' = 'blocks', it definitely means i have sufficient memory, because nothing is paged nor swaped to physical swap - right ?
Yes. But in a professional environment it makes sense to size a system
sufficiently. Memory does not come free of charge and it pays (or rather - saves) to give a system as much as it needs - but not more. It is the job of a systems administrator to walk that fine line between oversized (=wasting money) and undersized (=hurting the purpose).
You might want to read
this little introduction to performance tuning and monitoring for more details about swapping.
I hope that helps.
bakunin