Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Apr 2004 21:20:43 -0500
From:      "Jim C. Nasby" <jim@nasby.net>
To:        Uwe Doering <gemini@geminix.org>
Cc:        freebsd-performance@freebsd.org
Subject:   Re: How does disk caching work?
Message-ID:  <20040419022043.GO87362@nasby.net>
In-Reply-To: <4080DF9F.3040302@geminix.org>
References:  <20040416163845.GG87362@nasby.net> <E1BEbKR-000ISM-00.shmukler-mail-ru@f7.mail.ru> <20040416221211.GM87362@nasby.net> <4080DF9F.3040302@geminix.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Apr 17, 2004 at 09:41:19AM +0200, Uwe Doering wrote:
> The disk i/o buffers you refer to (the 'Buf' column in 'top') are the 
> actual interface between the VM system and the disk device drivers.  For 
> file and directory data, sets of VM pages get referred by and assigned 
> to disk i/o buffers.  There they are dealt with by a kernel daemon 
> process that does the actual synchronization between VM and disks. 
> That's where the soft updates algorithm is implemented, for instance.
> 
> In case of file and directory data, once the data has been written out 
> to disk (if the memory pages were "dirty") the respective disk i/o 
> buffer gets released immediately and can be recycled for other purposes, 
> since it just referred to memory pages that continue to exist within the 
> VM system.
> 
> Meta data (inodes etc.) is a different matter, though.  There is no VM 
> representation for this, so for disk i/o they have to be cached in extra 
> memory allocated for this purpose.  A disk i/o buffer then refers to 
> this memory range and tries to keep it around for as long as possible. 
> A classical cache algorithm like LRU recycles these buffers and memory 
> allocations eventually.
> 
> As usual, the actual implementation is even more complex, but I think 
> you got a picture of how it works.

Yes, much clearer now, thanks!

A few questions if I may...

What's a good way to tune amount of space dedicated to IO buffers?

What impact will vm_min|max_cache have on system performance? Is there
any advantage to setting it fairly high?

The machine I'm tuning is a dual Opteron box with 4G of ram, a mirror
and a 6 disk RAID10. It's running PostgreSQL.
-- 
Jim C. Nasby, Database Consultant                  jim@nasby.net
Member: Triangle Fraternity, Sports Car Club of America
Give your computer some brain candy! www.distributed.net Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"



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