How to calculate current kmem usage?

Mikolaj Golub to.my.trociny at gmail.com
Wed Jan 14 11:22:43 PST 2009


Hi,

Could someone explain please, how to calculate current kernel memory
utilization, one that is limited by vm.kmem_size?

There is a script on http://wiki.freebsd.org/ZFSTuningGuide that calculates
kernel memory utilization by summing the values from `kldstat' output (TEXT)
and the values from `vmstat -m' output (DATA). Are these the only data needed
for proper calculation of kmem?

What about zone(9) allocations? Shouldn't data from `vmstat -z' output be
added to calculate kmem usage?

The reason I am asking about this is that we are tuning vfs.ufs.dirhash_maxmem
on our storage servers. By default it is 2Mb that looks like very small
value. We increased it to 30Mb and all 30Mb were filled very quickly, so we
are considering to increase it more but we need the method to monitor the
system resources we can hit (we use the default value for vm.kmem_size 300Mb
that is not so large).

So what the system parameters we should monitor increasing vfs.ufs.dirhash_maxmem?
I see the growth of dirhash_maxmem corresponds the growth of wired
memory. Currently wired is 222M on this host. Isn't wired memory limited by
vm.kmem_size or it is limited only by vm.kvm_size?

BTW, how reasonably large the value of vfs.ufs.dirhash_maxmem can be? I have
seen recommendations to increase it until it all in usage, but may be there
are other considerations I should take into account? We use rsync on our
storage servers to synchronize data between the hosts and I suppose this is the
main dirhash_mem eater.

-- 
Mikolaj Golub


More information about the freebsd-hackers mailing list