buffer cache usage

Bruce Evans brde at optusnet.com.au
Tue Mar 19 12:11:29 UTC 2013


On Tue, 19 Mar 2013, Richard Kearsley wrote:

> I'm using FreeBSD and nginx as a web server serving static files. I always 
> like the "buffer cache" which lets frequently used files stay in memory 
> rather than read from disk again.
> I have a new server with 32GB of ram and I notice a lot of memory is listed 
> as "Inact":
>
> Mem: 688M Active, 26G Inact, 3758M Wired, 823M Cache, 3281M Buf, 173M Free

Inact more or less means "buffer cache" (actually VMIO memory).

Buf more or less means nothing (it is the amount of virtual memory reserved
but not necessarily used for mapping physical VMIO memory into virtual
memory (the classical buffer cache) so that it can be accessed easily).

If your "buffer cache" is working well, then it will have almost 26GB
of disks mapped into VMIO and almost 3281MB of this at a time mapped
into virtual memory.  The vm part of the mapping is a bit slow but not
nearly as slow as disks.  Except maybe with SSDs and/or huge arrays.

> What's preventing this ram from being used as buffer cache for files on the 
> hard disks? Is there a limit or a tunable stopping it? I never had a server 
> with this amount of ram before.

With less memory, the ratio of Inact to Buf would be smaller.  On i386,
Buf is excessively restricted even with physical memory limited to 4G,
since virtual address space is also limited to 4G and it is hard to
fit enough Buf in it.  Inact and VMIO are only limited by physical memory,
so the too-small Buf is not a large pessimization.

Bruce


More information about the freebsd-performance mailing list