# Nginx/freebsd kern.maxbcache

**URL:** <https://www.ruby-forum.com/t/nginx-freebsd-kern-maxbcache/227658>\
**Category:** NGINX\
**Created:** [March 22, 2013, 3:33pm UTC](https://www.ruby-forum.com/t/nginx-freebsd-kern-maxbcache/227658 "2013-03-22T15:33:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [March 22, 2013, 3:33pm UTC](https://www.ruby-forum.com/t/nginx-freebsd-kern-maxbcache/227658/1 "2013-03-22T15:33:35Z")

</div>

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

> <https://serverfault.com/questions/64356/freebsd-performance-tuning-sysctl-parameter-loader-conf-kernel>

and here [http://wiki.nginx.org/FreeBSDOptimizations](http://wiki.nginx.org/FreeBSDOptimizations)  
However, I can’t get the value of ‘vfs.maxbufspace’ to increase:  
kern.maxbcache: 21474836480  
vfs.maxbufspace: 3441033216

Did anyone else use this tunable and get results?

Many thanks  
Richard

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [March 23, 2013, 8:04pm UTC](https://www.ruby-forum.com/t/nginx-freebsd-kern-maxbcache/227658/2 "2013-03-23T20:04:10Z")

</div>

On Mar 22, 2013, at 6:32 PM, Richard K.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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  
> [FreeBSD performance tuning: Sysctl parameter, loader.conf, kernel - Server Fault](http://serverfault.com/questions/64356/freebsd-performance-tuning-sysctls-loader-conf-kernel)  
> and here [http://wiki.nginx.org/FreeBSDOptimizations](http://wiki.nginx.org/FreeBSDOptimizations)  
> 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  
removed\_email\_address@domain.invalid
