Subject: Re: explaining TOP memory output
To: None <netbsd-users@NetBSD.org>
From: Michael Parson <mparson@bl.org>
List: netbsd-users
Date: 07/13/2006 15:03:33
On Thu, Jul 13, 2006 at 02:43:29PM -0500, Przemys?aw Pawe?czyk wrote:
> On Thu, 13 Jul 2006 13:10:57 -0500
> Michael Parson <mparson@bl.org>wrote:
>
>> Doesn't look like it's a memory issue.  All your CPU time is being used
>> in user-space, not system, which would suggest NetBSD is just spending
>> a lot of time executing the program, not spending a lot of time paging
>> stuff on and off disk.
>>
>> I'd watch the output of 'vmstat 5' for a while before and during use of
>> this program to verify.
>>
>> Is Deer Park compiled natively for NetBSD?  Or are you running the Linux
>> version under emulation?
>
> Hi,
>
> No I run away from emulation - too much hussle. I use only binary versions.
>
> But do you know what the TOP options means - Act, Inact, etc.?
>
> For example:
> Memory: 67M Act, 34M Inact, 884K Wired, 26M Exec, 11M File, 812K Free

I generally don't depend on top when I'm trying to debug memory usage,
it tends to give an incomplete picture.  Instead, I like vmstat (NetBSD
3.0/i386, PIII-800, 512M ram, while compiling sysutils/top out of
pkgsrc):

$ vmstat 5
 procs    memory      page                       disks      faults      cpu
 r b w    avm    fre  flt  re  pi   po   fr   sr f0 m0 w0   in   sy  cs us sy id
 3 0 0 292804   2836  288   8   0    0    4   18  0  0  6  115  953  41  5  2 93
 1 0 0 291784   3924 6409   0   0    0  218  218  0  0 28  154 5807 337 69 23  8
 0 0 0 286620   9552 2729   0   0    0    0    0  0  0 36  148 3298 188 29 12 59
 0 0 0 286620   9552    2   0   0    0    0    0  0  0  7  112   43  16  0 0 100
 0 0 0 287172   9208   44   0   0    0    0    0  0  0 45  150  108  50  0  1 99
 0 0 0 287172   9136  183   0   0    0    0    0  0  0  3  115  203  37  0  1 99
 0 0 0 287148   9112   18   0   0    0    0    0  0  0  1  114  110  30  1  0 99

Watch the "pi" and "po" columns for heavy activity, it will tell you the
page-ins and page-outs.  Also watch the last four columns under Faults
and CPU, they'll give you some hints on where the CPU is spending it's
time.  Heavy swapping usually coincides with heavy entries in 'cs' and
'sy'.

But, like others have pointed out, you can tweek NetBSD's memory usage
using sysctl.  Based on some reading somewhere, a long time ago, my /etc/sysctl.conf
has this in it:

vm.anonmin=20
vm.anonmax=80

vm.execmin=10
vm.execmax=30

vm.filemin=5
vm.filemax=25

This box doesn't run X, it's a colo-ed box for myself and a few friends
to have shell, web, mail, etc, on.  The only web browsers installed are
the text based links and lynx.

The fact that you have a high-ish load, with an idle CPU is what
concerns me.  You have something that is causing your load queue length
to be artificially high.

System performance tuning is about as much an art as it is a science.

-- 
Michael Parson
mparson@bl.org