From owner-freebsd-fs Tue Oct 1 20:25:36 1996 Return-Path: owner-fs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id UAA26070 for fs-outgoing; Tue, 1 Oct 1996 20:25:36 -0700 (PDT) Received: from dyson.iquest.net (dyson.iquest.net [198.70.144.127]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id UAA26062 for ; Tue, 1 Oct 1996 20:25:30 -0700 (PDT) Received: (from root@localhost) by dyson.iquest.net (8.7.5/8.6.9) id WAA04042; Tue, 1 Oct 1996 22:23:47 -0500 (EST) From: "John S. Dyson" Message-Id: <199610020323.WAA04042@dyson.iquest.net> Subject: Re: nbuf in buffer cache To: heo@cslsun10.sogang.ac.kr (Heo Sung-Gwan) Date: Tue, 1 Oct 1996 22:23:46 -0500 (EST) Cc: freebsd-fs@FreeBSD.ORG In-Reply-To: from "Heo Sung-Gwan" at Oct 2, 96 12:00:00 pm Reply-To: dyson@FreeBSD.ORG X-Mailer: ELM [version 2.4 PL24 ME8] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-fs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > > If NBUF is not defined and physical memory is less than 1024 pages(= 4Mbytes) > then nbuf becomes 30, and otherwise nbuf is 30 + min((physmem - 1024) / 12, > 1024). > > Why does the number of buffers is calculated in this fashion? > 30 buffers, 1024 pages, and division by 12 have special meaning? > There is no comment on source code. > Experience shows that this is a good number. 30 Buffers is a good minimum on a very small system. There has been problems in earlier code (and perhaps even -current) when running with less than 10 Buffers. > > In addition, if there is no user application processes how many buffers > are enough to run the system without degrading the performance of the system? > Only 30 buffers? Or better as many as possible? > The performance on a small system is poor (IMO) anyway. Adding more buffers will take more memory from runnable processes. Generally, common wisdom and practice shows that it is best to minimize paging. 30 buffers represents approx 240K (on a normally configured filesystem.) If there is more free memory, the system will store cached data in memory not associated with buffers. On a 4MB system, this is uncommon though. Unlike other *BSD's the buffer cache isn't the only place that I/O cached data is stored. On FreeBSD the buffer cache is best thought of as a mapping cache, and also the upper limit of dirty buffer space. Free memory is used for caching both file data and unused memory segments (.text,...). John