maximum MAXBSIZE

Eugene Grosbein eugen at grosbein.net
Thu Jan 9 20:28:24 UTC 2020


10.01.2020 2:42, Wojciech Puchar wrote:

>> POLA (principle of least amazement).  I certainly don't need a MAXPHYS set
>> to 4MB on my desktop machine.  Not everyone using FreeBSD is running
> 
> i do if i have HDD - because i want good performance when say copying big file.

I can tell you one real-life story about one of my FreeBSD servers.
One of its task is collecting thousands of integer packet counters from many switches over SNMP
to store them in thousands RRD files and draw graphs on-demand later.

Due to high parallelism of custom scripts collecting values, it successfully collects data
from 2500+ switches within one minute obtaining tens of counters per SNMP request
storing data to temporary plain files before moving data to RRDs.

There is another independent process scanning temporary files and using rrdtool to insert data to RRDs.
With untuned 8.4-STABLE, that second process took less than one minute to process 2500+ RRD files.
After 8.4 went EoL the server was upgraded to FreeBSD 9 and the second process suddenly
became 6 times slower and UFS went much less responsible here. It took not much time for me to discover
that default value for sysctl vfs.read_max changed from 8 blocks for FreeeBSD 8 to 64 block for FreeBSD 9,
so read-ahead of UFS boosted reading database files eight times consuming I/O bandwidth and cache.

The problem is, opening an RRD file for update and reading its header does NOT mean
reading so many blocks would be of any use, so it just wasted time and memory.

I lowered vfs.read_max back to old default 8 blocks. The server has UFS block size equal to 16K,
and 8*16K=128K=MAXPHYS, so performance boosted 6 times and returned to previous normal state.
The server then was updated several times more but still keeps vfs.read_max=8 in its /etc/sysctl.conf
and runs just fine.

Not each yoghurt is equally good for everyone.



More information about the freebsd-hackers mailing list