Disk cache tuning

Eugene L. Vorokov vel at infotecs.biz
Tue Jul 21 10:07:28 UTC 2009

Hello guys,
I have an amd64 server with 8 cpu cores and 16Gb of memory, with FreeBSD
7.2. It is used as a corporate CVS server with several huge repositories 
(about 2Gb each), which consist of thousands of rather small files. I need
to tune the system so that it caches as much files as possible and minimizes
physical access to the disk. Of course, I did enable softupdates, but I have
an impression that more things can be tuned.

Specifically, I have read in many places that FreeBSD uses all available
memory for disk cache, because disk buffers are integrated with vm pager.
However, when I do cvs checkout to the same disk where the repository
resides and watch memory usage (by top or systat), repeating that several
times to activate the cache, I notice that for 2Gb repository system
hardly uses more than 1Gb of memory (including inactive) even after 3-4
checkouts of the same repository, and disk is still used a lot. Why this
happens ? How can I tell the system to use as much memory for caching as
possible ?
I also notice that the buffer cache expires pretty fast: the first
checkout takes 2 minutes, if I do checkout again immediately, it takes 1.5
minutes, but if I do it again after waiting a minute, it takes 2 minutes
again, even though the machine was completely inactive while I was
waiting. Why the cache expires at all when there is a lot of free memory ?
Can I somehow tell the system to keep everything cached until something is
modified or some process needs memory ?
Thank you in advance, please Cc: me as I'm not on this list. If there is
more appropriate list for my questions, please point me to one.


More information about the freebsd-questions mailing list