Monday, August 08, 2005

How do I find out what my machine's memory is being used for?

Subject: 6.4) How do I find out what my machine's memory is being used for?
How can I tell if I need more memory?

To discover how much virtual memory (i.e. swap) is free, run "swap -s" or
"vmstat". If you're using tmpfs for /tmp, "df /tmp" will also work.

Discovering how physical memory is being used can be more difficult,
however. Memory pages that are not being used by processes are used as a
sort of extended cache, storing pages of memory-mapped files for possible
later use. The kernel keeps only a small set of pages free for short-term
use, and frees up more on demand. Hence the free memory reported by vmstat
is not an accurate reflection, for example, of the amount of memory
available for user processes.

An easy way to determine whether or not your machine needs more memory
is to run vmstat and examine the po (page out) column and the sr (scan
rate) column. If these columns consistently show large numbers, this
suggests that your machine does not have enough memory to support its
current workload, and frequently needs to write pages belonging to
active processes to disk in order to free up enough memory to run the
current job.


Post a Comment

<< Home