Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Oct 1996 22:23:46 -0500 (EST)
From:      "John S. Dyson" <toor@dyson.iquest.net>
To:        heo@cslsun10.sogang.ac.kr (Heo Sung-Gwan)
Cc:        freebsd-fs@FreeBSD.ORG
Subject:   Re: nbuf in buffer cache
Message-ID:  <199610020323.WAA04042@dyson.iquest.net>
In-Reply-To: <Pine.SUN.3.93.961002115902.4123A-100000@cslsun10> from "Heo Sung-Gwan" at Oct 2, 96 12:00:00 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> 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



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