D
D
Dmitry Yaroshenko2014-09-25 17:59:06
FreeBSD
Dmitry Yaroshenko, 2014-09-25 17:59:06

Why doesn't disk read caching work in FreeBSD?

FreeBSD 9.2
Mem: 392M Active, 2385M Inact, 1808M Wired, 1583M Buf, 26G Free
$ find . -type f | wc -l
26271
$ du -hs
774M .
$ time find . -type f | xargs cat > /dev/null
real 0m22.487s
user 0m0.025s
sys 0m0.797s
$ time find . -type f | xargs cat > /dev/null
real 0m26.454s
user 0m0.055s
sys 0m0.764s
The files in the directory do not change between the last two commands, in gstat when these commands are executed, disk reading is observed with the same intensity.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Yaroshenko, 2014-10-20
@harloprillar

And here is the answer: the number of files that can be cached is determined by the kern.maxvnodes parameter. For me it was equal to 20000. Since there are a lot of files (26k), some of them did not get into the cache. After increasing the parameter, everything works as it should.
upd. The total amount of memory that can be used for the disk cache is vfs.maxbufspace. To increase x64 tune kern.nbuf: vfs.maxbufspace / 16384 = kern.nbuf(ro, loader.conf)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question