nginx/freebsd kern.maxbcache

Sergey Kandaurov pluknet at
Sat Mar 23 19:03:51 UTC 2013

On Mar 22, 2013, at 6:32 PM, Richard Kearsley <rkearsley at> wrote:
> Hi
> I'm trying to tune 'kern.maxbcache' with hope of increasing 'vfs.maxbufspace' so that more files can be stored in buffer memory on freebsd 9.1
> It's suggested to tune this value here and here
> However, I can't get the value of 'vfs.maxbufspace' to increase:
> kern.maxbcache: 21474836480
> vfs.maxbufspace: 3441033216

I assume that you have 9.1 amd64, the following applies only to amd64.
On amd64 maxbcache is zero by default and effectively is no-op,
thus it doesn't further limit maxbufspace (cf. on i386 it's set to 200MB,
due to KVA constraints; and buffer space is reserved in KVM on early boot).
The kernel auto-tunes maxbufspace based on the amount of
physical memory available using the formula "for the first 64 MB of ram
use 1/4 for buffers, plus 1/10 of the ram over 64 MB". So, your current
vfs.maxbufspace value corresponds to 32GB RAM and is quite enough.
Anyway, you can further increase it by setting kern.nbuf in /boot/loader.conf
With your current maxbufspace value, it's kern.nbuf=210024 now.

Sergey Kandaurov
pluknet at

More information about the nginx mailing list