ZFS ARC Cache tuning for a laptop...
By Marco Milo on Oct 29, 2010
I've my laptop (Toshiba Tecra M5 - Intel Core2-Duo@2GHz - 2GB RAM) with OpenSolaris (snv_150) and I've noted that sometimes it becomes slow and unresponsive for a few seconds in which the disk was spinning hardly... a very simple probe showed the problem:
# kstat -m zfs -n arcstats -T d 2
I'll save you all the neverending output, but the interesting numbers were the ones coming from c,c_max, c_min and size.
As I read on the ZFS Evil Tuning Guide :
[...] The ZFS Adaptive Replacement Cache (ARC) tries to use most of a system's
available memory to cache file system data. The default is to use all
of physical memory except 1 GB. As memory pressure increases, the ARC
relinquishes memory. [...]
Mine problem was that when trying to launch many application (typically at the login, when you may start Firefox, Thunderbird, Netbeans, Acrobat Reader and OpenOffice almost sequentially) the laptop was clogged up and was with the disk spinning and almost unresponsive. I know that my laptop has limited performances and is not the latest piece of hardware available on the market, but still when I launch the same applications under other O.S.-es [both Linux Ubuntu 10.10 (64-bit) and WinXP SP3 (32-bit)] I don't have to wait that long and the system looks more responsive.
Monitoring the size parameter of the ARC cache, I've seen that it was always around 1 GB Size, and the applications were instead unable to run with few available memory and swapping on the disk... this was not sane.
First I shrinked the amount of ram allocated for ZFS ARC live (as explained in the "ZFS Guide", and since the performances and the stability of the machine seemed improved, I set that value into the /etc/system file to make it persistent across reboots:
set zfs:zfs_arc_max = 822083584
Even if the ZFS ARC cache size is more constant now (I've an average that is close to the set value, with limited 'fluctuations'), I'm running without any apparent problem.... So far, so good