Wednesday, April 4, 2007

Swap Market

How to find out if you are using swap? These days, you should have plenty of memory, even with the piggish apps we all use. So you might want to find out how often you are using the swap space, to see if it is time to splurge on a RAM. Well, it is vmstat to the rescue:



$ vmstat 5
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
1 2 204 4340 29984 140436 0 0 281 122 238 773 25 6 62 7
1 2 204 5636 26188 139620 0 0 1612 3793 1111 1953 5 5 1 89
0 2 204 8032 25420 133464 0 0 1516 30 1115 2342 6 6 0 87
1 1 204 7020 26068 130084 0 0 1444 89 1042 2289 10 7 0 83
0 1 204 13604 21472 129780 0 0 2158 65 937 1911 22 21 0 56
1 2 204 5884 22888 127960 0 0 1640 2 1180 2495 8 7 2 83


The main column you want to look at is the swap 'so' column. This tells you the amount of memory 'swapped out'. In my case, it is zero, so we're looking good, although I only have 1gb of RAM. I still think I'll grab another gigabyte. The '5' means to update the status every 5 seconds. And the first line shows the average of all the numbers since the machine was last rebooted, which is cool. As I've taken to shutting down all my machines every night, it isn't as interesting as it would have been a month ago, when the machine would run for weeks at a time.




No comments:

Post a Comment