FreeBSD 9.1 x64 ZFS tunables not getting set

I'm testing out FreeBSD 9.1 for a ZFS build and I'm having some issues with some of the tunables that are recommended on the wiki. For each of the settings in the L2ARC discussion section, they say they cannot go in /etc/sysctl.conf because they need to be present before the ZFS pool is loaded. I'm pretty new to FreeBSD and I found that they should probably go in /boot/loader.conf, so I went and threw them in there. The strange part is... they don't all seem to work. The following sysctl variables never seem to change if I place them in the loader.conf:
  • vfs.zfs.l2arc_write_max
  • vfs.zfs.l2arc_write_boost
  • vfs.zfs.l2arc_headroom
Do they still need to go in loader.conf? Is there somewhere else they should be placed so that they will be read before the pool is imported? Does it not matter when they are read anymore? See the output below displaying that write_max does not change but prefetch does. Any input is appreciated! :e

Code:
[CMD=#]uname -a[/CMD]
FreeBSD zfstest 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243825: Tue Dec  4 09:23:10 UTC 2012     [email]root@farrell.cse.buffalo.edu[/email]:/usr/obj/usr/src/sys/GENERIC  amd64
[CMD=#]sysctl vfs.zfs.l2arc_write_max[/CMD]
vfs.zfs.l2arc_write_max: 8388608
[CMD=#]sysctl vfs.zfs.prefetch_disable[/CMD]
vfs.zfs.prefetch_disable: 1
[CMD=#]cat /boot/loader.conf[/CMD]
vfs.zfs.l2arc_write_max="209715200"
vfs.zfs.prefetch_disable="0"

[CMD=#]reboot[/CMD]
<log back in>

[CMD=#]sysctl vfs.zfs.prefetch_disable[/CMD]
vfs.zfs.prefetch_disable: 0
[CMD=#]sysctl vfs.zfs.l2arc_write_max[/CMD]
vfs.zfs.l2arc_write_max: 8388608
 
There are two tunables that could be set to control how fast data is written onto the L2ARC. The first one is vfs.zfs.l2arc_write_max, whose default value is 8MB and the other one is vfs.zfs.l2arc_feed_min_ms, whose default value is 200. The first tunable determine what is the maximum amount of data that can be written onto the L2ARC for each write, while the second tunable determine the shortest time elapsed for the next write onto L2ARC. This means that the maximum rate of data written onto the L2ARC in the default setting is actually 40MBps.

If you understand the above, you will see that setting vfs.zfs.l2arc_write_max to a very large value without changing vfs.zfs.l2arc_feed_min_ms will be detrimental to the performance of the L2ARC. I do not know why the setting in /boot/loader.conf is being ignored. But you can change the rate of data written onto the L2ARC by changing vfs.zfs.l2arc_feed_min_ms. And this can be done on the command line and take effect immediately. E.g. # sysctl vfs.zfs.l2arc_feed_min_ms=100 will effectively increase the maximum rate to 80MBps. However, I have to try such a value though (I have only increase it), so be sure to check whether it will have adverse effect on the load of the system.
 
Try removing the quotation marks and putting those settings in /etc/sysctl.conf. It seems like those can't be set in /boot/loader.conf for some reason, but I don't know why. I don't have a problem setting vfs.zfs.arc_max in /boot/loader.conf, however.

Kevin Barry
 
Back
Top