From owner-freebsd-hackers Tue Nov 18 20:12:14 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id UAA24439 for hackers-outgoing; Tue, 18 Nov 1997 20:12:14 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from sasami.jurai.net (winter@sasami.jurai.net [207.96.1.17]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id UAA24434 for ; Tue, 18 Nov 1997 20:12:11 -0800 (PST) (envelope-from winter@jurai.net) Received: from localhost (winter@localhost) by sasami.jurai.net (8.8.7/8.8.7) with SMTP id XAA24391; Tue, 18 Nov 1997 23:11:57 -0500 (EST) Date: Tue, 18 Nov 1997 23:11:56 -0500 (EST) From: "Matthew N. Dodd" To: Arjan de Vet cc: hackers@FreeBSD.ORG Subject: Re: caching only directory disk blocks In-Reply-To: <199711182225.XAA14266@adv.IAEhv.nl> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Tue, 18 Nov 1997, Arjan de Vet wrote: > Would it be possible to create a mount option (or something else) which > would only cache disk blocks from directories and not disk blocks from > 'normal' files? Or give the former precedence over the latter for staying > in the buffer cache? Have you looked at the output of `vmstat -s` and looked at the name lookup statistics? I believe there is a sysctl that allows you to tune how much memory you allow the name cache to use, but I can't remember what it is right now. > The reason why I'm asking this? I'm currently playing with the Squid > proxy-cache to improve its usage of the file system cache. For > applications like Squid it's very important to keep as much directory > blocks in the buffer cache as possible. Caching of 'normal' files doesn't > make any sense because Squid has its own hot-object cache and most file > access is too random anyway in order for the buffer cache to be useful. I'm not sure how squid works, but in my world it would save the files in wire format, open, mmap, close (to cut down on FDs used) and just write the whole thing when someone asks for it. The cache would optimally keep track of the highest hit pages and use madvise to insure that they are or aren't cached. I would check the source to see if squid doesn't already do something like this. Have a good one. /* Matthew N. Dodd | A memory retaining a love you had for life winter@jurai.net | As cruel as it seems nothing ever seems to http://www.jurai.net/~winter | go right - FLA M 3.1:53 */