Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Dec 1995 18:08:20 -0700 (MST)
From:      Ade Barkah <mbarkah@hemi.com>
To:        joe@ns.via.net (Joe McGuckin)
Cc:        hackers@freebsd.org
Subject:   Re: Need more memory?
Message-ID:  <199512210108.SAA10030@hemi.com>
In-Reply-To: <199512202125.NAA07272@ns.via.net> from "Joe McGuckin" at Dec 20, 95 01:25:31 pm

next in thread | previous in thread | raw e-mail | index | archive | help

> What is a good indication of when you need to add ram.

The best indicator might be to monitor the `vmstat' utility. 
The two parameters to glance at are "avm" (active virtual pages) 
and "fre" (the size of the free list.)

The avm is how much "virtual memory" your processes are using.
Since some memory is shared, others can be swapped out, etc.,
the avm can be larger than the amount of real physical memory
you have without adversely affecting performance. A rule of
thumb is you're doing well when avm is less than twice your
physical memory, but for a typical workstation the avm can be
much larger than the physical memory and you'd still be ok.
This is especially true if you're running something like 
X-windows.

The "fre" parameter gives you a more direct (absolute) hint of 
how much physical memory is left free. If the free list gets real 
low all the time, then maybe it's time to add memory.

When memory is low (as shown by huge avm and low fre), then you
can see how badly you're doing by the paging activity parameters
in vmstat, the "fr", "po" and "sr" parameters (and perhaps "de").

"fr" is the amount of pages freed per second. Since pages are 
always freed by normal activities, you'll always see some fr
activity so it's less interesting normally.

"sr" shows the amount of pages scanned by the clock algorithm.
Activity here means you're at the short end of the stick. 
Basically the system is actively searching for pages to be 
swapped out. "de" marks an artificially placed demand to help
the system from trashing... it means you're past the deep end. =)

When you think the system is starting to swap (sr shows activity)
then check out "po" (pages paged out) and the swap space statistics.
If po is really active then you're running out of memory fast. If
po shows some tiny numbers once in a very long while, it's probably
just vm "trash" and not a concern.

You examine the swap space statistics by using the `pstat -T'
command. It will show something like `0M/127M swap space' (meaning
you're using 0 swap from the 127mb you reserved.) Again, a
moderate number of processes swapped out is usually fine
(these processes are probably idling anyway.) You can find
out which processes are swapped out by using the `ps' command
(the RSS of the process will be zero, and the process will
have a "W" flag marked in its state.)

On the other hand, if `pstat -T' shows your swap space if full,
then you pick up the microphone and say, "Houston... we got a
problem..."

Running other cool programs like `top' periodically also helps
you stay in front of demand. Some people run all these utilities
(and some others like iostat and netstat) periodically from a 
script to maintain hourly statistics like whats kept by the sar/sag
utilities in System V (I kinda miss those daily sag graphs.)

Regards,

-Ade Barkah
--------------------------------------------------------------------
Inet: mbarkah@hemi.com - HEMISPHERE ONLINE - www: <http://hemi.com/>;
--------------------------------------------------------------------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512210108.SAA10030>