Subject: Re: Bad response...
To: Johnny Billquist <bqt@Update.UU.SE>
From: Chuck Silvers <>
List: current-users
Date: 08/27/2004 08:08:17
On Fri, Aug 27, 2004 at 11:20:14AM +0200, Johnny Billquist wrote:
> I'm getting tired of the fact that my system's response have gone down 
> dramatically the last year or so.
> I believe the problem is in the unified memory buffer handling. The disk 
> cache is way to agressive in grabbing memory.

the big thing that's changed this year with respect to file system caching
is that the metadata buffer cache now allocates memory dynamically rather than
have a static memory allocation done at boot time.  this is separate from
the "unified" cache for regular file data.  if your performance was better
last year, then the metadata cache is a more likely suspect, but we should
analyze the problem rather than just guessing.

> I have 128MB in the machine, and am currently experiencing a load of about 
> 4, with over 90% processor idle time, and *lots* of paging. At the same 
> time, the file cache is holding 33 MB of memory.

when the system is in this state, could you collect the output of

	ps aux
	top | head -20
	sysctl -a | grep ^vm
	vmstat -m 
	vmstat -c 10

and send them to me?  also, please describe what you're running on the
machine that triggers the poor performance.

> I think the system currently is very badly tuned by default.

clearly your workload is not performing well with your system configuration.
we'll need more information to determine if the performance can be improved
using existing sysctl knobs, if there's a code change we can make to improve
performance, or if that's just the best that can be done with your hardware.
I'm entirely willing to believe that your hardware is adequate and that
we can improve the performance by changing the software, but we'll need
more stats from the system and details on what you're doing with the machine
to be able to figure out what to change.

> But I know that people probably disagree with me, so I have just one 
> question: how do I limit the file cache to take no more than, say, 16 MB?
> No matter how much the system thinks it *might* be able to use.

on that machine, if you do "sysctl -w vm.filemax=12", then the VM system
will never use more than 12% (ie. around 16 MB) of RAM to cache file data
if anything else wants to use the memory beyond that.  there is no way
to make the VM system leave RAM sitting around completely unused.

note that these percentages are only talking about regular file data,
not metadata.  the limit on memory used for metadata is controlled by
a different sysctl tunable, vm.bufmem_hiwater.  the default value for
that appears to be 15% of RAM.  you can see the current amount of memory
used for this via the sysctl node vm.bufmem.