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 ?
Some statistics are absolute, in that case a short interval will allow to show transient events that would be missed otherwise. Some other statistics are counters, and vmstat will show their average changing rate. In that case, whatever the interval, the average will be correct but of course you would still miss variations in that rate with a long sampling interval.
Quote:
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 ?
This is true for anonymous pages, but pages that are backed by files would be paged out elsewhere, or just dropped if unchanged.
Quote:
If so, why isn't swap -l an accurate way of saying if there is a memory shortage ?
There is no clear definition of what a RAM shortage is. Beware not to confuse RAM and (virtual) memory. You can have a memory shortage with the swap area untouched and plenty of RAM reported to be free. On the opposite, your RAM might be undersized even while the swap area is untouched.
Quote:
is it because sometimes paging unused memory out is healthy and necessary -> so we cannot just determine that memory is insufficient base on physical swap-space being used - is my understanding correct ?
It is never strictly necessary, but a good idea for the system to free resources wasted otherwise.
Quote:
3) 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 swapped to physical swap - right ?
Yes, although as I previously wrote, performance might be better with more RAM in that case.