From owner-freebsd-stable@FreeBSD.ORG Mon Nov 8 21:20:44 2004 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3F73B16A4CF for ; Mon, 8 Nov 2004 21:20:44 +0000 (GMT) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id 15B8243D39 for ; Mon, 8 Nov 2004 21:20:44 +0000 (GMT) (envelope-from cswiger@mac.com) Received: from mac.com (smtpin02-en2 [10.13.10.147]) by smtpout.mac.com (Xserve/MantshX 2.0) with ESMTP id iA8LKhv3011728; Mon, 8 Nov 2004 13:20:43 -0800 (PST) Received: from [10.1.1.245] (nfw2.codefab.com [199.103.21.225] (may be forged)) (authenticated bits=0)iA8LKgb0017906; Mon, 8 Nov 2004 13:20:42 -0800 (PST) In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <0B0B1841-31CC-11D9-8097-003065ABFD92@mac.com> Content-Transfer-Encoding: 7bit From: Charles Swiger Date: Mon, 8 Nov 2004 16:20:41 -0500 To: cscott@speakeasy.net X-Mailer: Apple Mail (2.619) cc: freebsd-stable@freebsd.org Subject: Re: Filesystem buffer size X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Nov 2004 21:20:44 -0000 On Nov 8, 2004, at 1:17 PM, cscott@speakeasy.net wrote: > I have a server thats sole purpose for existence is serving a fixed > group of files from a dedicated filesystem. There is a directory tree > with about 50K files that is requested in a random order. I have been > trying find the correct sysctl variable to dedicate more RAM to the > filesystem buffer to reduce the latency in the server caused by the FS > reads. Is there such a variable? What is the variable I should be > working with? vfs.maxbufspace is read-only. So long as the system has enough memory available for the working sets of the processes being run, FreeBSD will use the rest of the memory for caching stuff from the filesystem without needing any special tuning. However, if you really want to be sure that the files stay in memory, consider using a RAMdisk (see "man md"). You might also want to read all of "man tuning", but the following section is particularly relevant to your case: The vfs.vmiodirenable sysctl defaults to 1 (on). This parameter controls how directories are cached by the system. Most directories are small and use but a single fragment (typically 1K) in the filesystem and even less (typically 512 bytes) in the buffer cache. However, when operating in the default mode the buffer cache will only cache a fixed number of directories even if you have a huge amount of memory. Turning on this sysctl allows the buffer cache to use the VM Page Cache to cache the directories. [ ... ] There are various other buffer-cache and VM page cache related sysctls. We do not recommend modifying these values. As of FreeBSD 4.3, the VM system does an extremely good job tuning itself. -- -Chuck