Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Nov 2007 13:14:31 +0000
From:      bruce@cran.org.uk
To:        Laszlo Nagy <gandalf@shopzeus.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: How to set maximum disk cache size?
Message-ID:  <20071116131430.GA27885@muon.bluestop.org>
In-Reply-To: <473D8940.3030501@shopzeus.com>
References:  <473C7C0A.4060708@shopzeus.com> <20071115182220.E60452@wojtek.tensor.gdynia.pl> <473CAF70.1090006@cran.org.uk> <473D8940.3030501@shopzeus.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Nov 16, 2007 at 01:12:48PM +0100, Laszlo Nagy wrote:
> Bruce Cran ?rta:
> >Wojciech Puchar wrote:
> >> Laszlo wrote:
> >>>Hi All,
> >>>
> >>>Is there a way (sysctl?) to tell FreeBSD (6.2 RELEASE) how many 
> >>>memory can it use for caching file data from disk?
> >>>
> >>>It might be that FreeBSD will use all available RAM, and reduce the 
> >>>cache 
> >>it already does
> >
> >It may seem strange since it's generally accepted that you can never 
> >have enough disk cache, but FreeBSD apparently doesn't actually use 
> >all the free memory for caching.  By default it uses up to 256MB for 
> >buffering/caching and there's no way it can use all available memory 
> >on i386 in machines with more than 1GB installed since the 
> >buffer/cache is allocated from KVM and the default maximum is 1GB.  
> >You can increase the amount of memory used, but it might not help - 
> >there's a thread on performance@ from 2004 which describes how it all 
> >works; see 
> >http://lists.freebsd.org/pipermail/freebsd-performance/2004-April/000785.html 
> >
> >The information there is quite old now though so I don't know if 
> >things are done differently in 6.x.
> OK, and how about amd64 arch? The reason I ask this is that we have a 
> big postresql database (over 3GB) and PostgreSQL rely on the OS for 
> caching files in memory. This database is mostly read-only, so it would 
> be nice to use all free memory for caching. Especially that this machine 
> is the database server, it does nothing else. Now, it is an i386 but we 
> are about to migrate to AMD X2, then we can put in 8GB of memory. But 
> only if the OS can use if for caching. Otherwise it would be useless.
> 
> Thank you for the link. That thread is quite old - things might have 
> changed.
> 
> Thanks,
> 
>    Laszlo
>

I'm just going by what I've read on current@ but it seems things are
still the same, both on i386 and amd64.  I don't know if it's happened
yet, but I think there was a plan to dramatically increase the kernel
address space for 7.0 on amd64, mainly triggered I think by ZFS which
likes to allocate loads of kernel memory.   See
http://lists.freebsd.org/pipermail/freebsd-current/2007-September/077250.html
for a more recent discussion.

--
Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071116131430.GA27885>