Subject: Re: explaining TOP memory output
To: Michael Parson <mparson@bl.org>
From: Johnny Billquist <bqt@softjar.se>
List: netbsd-users
Date: 07/13/2006 20:29:07
I don't agree.
If you look closer, the CPU isn't spending the time in the user program 
either. It's running idle for lots of the time.

I suspect this is the same issue that have been up before. NetBSD seems 
to be too agressive in using memory for disk cache, forcing programs out 
on the swap area too much. You get lots of page faults, and slow 
execution. CPU is idle, yet nothing can be done.

I think a few people have summed up different ways of re-tuning this.
The relevant man-pages are (afaik) sysctl(8) and sysctl(3) (and maybe 
uvm(9)).

	Johnny

Michael Parson wrote:
> On Thu, Jul 13, 2006 at 12:25:05PM -0500, Przemys?aw Pawe?czyk wrote:
>> Hi,
>>
>> I've come from Debian world. I used to run Opera, Sylpheed, and Tea
>> editor. Now I use Deer Park (it has smaller footprint than Firefox,
>> hasn't it?), Sylpheed, and Nedit. My system is very modest: Celeron
>> 400, 128 MB DRAM, 2 HDD (40 GB for children's Win98, and 8 GB for
>> NetBSD).
>>
>> I do not understand the memory output in TOP application. How to read
>> it? The problem I have concerns slowness of the system running NetBSD
>> with Deer Park. I did not have the problems working with Debian.
>>
>> Deer Park seams to take up part of swap partition than chunk of memory
>> what makes every page opens too slowly. God forbid if I run ogg
>> encoder then. Which is a must for me as I have to record some radio
>> talk shows.
>>
>> There's "Inact" field in TOP readout, what I read as
>> "inactive". Sometimes both Inact and swap Used size are equal. If I
>> was able to use the Inact memory I wouldn't use swap and Deer Park
>> responsivness would be improved. Am I right? I badly need the free
>> memory. I suppose I'm right as some small scripts run very fast, what
>> in Debian would be impossible due to swap-memory exchanges.
>>
>> Is there any way to deal with memory usage in NetBSD?
>>
>> I recorded four TOP outputs.
>>
>> 1) System has just started without any applications (with X)
>> load averages:  0.79,  0.36,  0.15                                                         05:37:52
>> 32 processes:  1 runnable, 30 sleeping, 1 on processor
>> CPU states:  1.0% user,  0.0% nice,  2.0% system,  0.0% interrupt, 97.0% idle
>> Memory: 44M Act, 500K Wired, 13M Exec, 13M File, 56M Free
>> Swap: 300M Total, 300M Free
>>
>> 2) Deer Park running
>> load averages:  1.03,  0.49,  0.20                                                         05:38:46
>> 33 processes:  32 sleeping, 1 on processor
>> CPU states: 52.2% user,  0.0% nice,  2.0% system,  0.0% interrupt, 45.8% idle
>> Memory: 92M Act, 668K Wired, 31M Exec, 22M File, 7904K Free
>> Swap: 300M Total, 300M Free
>>
>> 3) After some time
>> load averages:  1.24,  1.15,  1.02                                                         06:30:49
>> 38 processes:  1 runnable, 36 sleeping, 1 on processor
>> CPU states: 55.2% user,  0.0% nice, 10.0% system,  0.0% interrupt, 34.8% idle
>> Memory: 69M Act, 35M Inact, 624K Wired, 26M Exec, 9520K File, 1160K Free
>> Swap: 300M Total, 19M Used, 281M Free
>>
>> 4) More time passed...
>> load averages:  1.23,  1.16,  0.88                                                         07:42:06
>> 32 processes:  1 runnable, 30 sleeping, 1 on processor
>> CPU states:  0.0% user,  0.0% nice,  0.0% system,  0.5% interrupt, 99.5% idle
>> Memory: 41M Act, 20M Inact, 536K Wired, 9344K Exec, 43M File, 44M Free
>> Swap: 300M Total, 23M Used, 277M Free
> 
> 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?
>