buffer cache usage

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

buffer cache usage

Richard Kearsley
Hi
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

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.
It's a very busy server, I'm sure a lot of files are accessed regularly
as the disks are always busy.

Using 9.1 amd64:
FreeBSD richard 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec 4
09:23:10 UTC 2012
[hidden email]:/usr/obj/usr/src/sys/GENERIC amd64

Many thanks
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-performance
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: buffer cache usage

Bruce Evans-4
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
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-performance
To unsubscribe, send any mail to "[hidden email]"