How to set up ZFS ARC size on Ubuntu.

By default ZFS uses 50 % of the host memory for the “Adaptive Replacement Cache” (ARC). Allocating enough memory for the ARC is crucial for IO performance, so reduce it with caution. As a general rule of thumb, allocate at least 2 GiB Base + 1 GiB/TiB-Storage. For example, if you have a pool with 8 TiB of available storage space then you should use 10 GiB of memory for the ARC.

This tutorial requires you to be logged in as root, so switch to root user if you are not already.

$ sudo -i

You can change the ARC usage limit for the current boot (a reboot resets this change again) by writing to the zfs_arc_max module parameter directly:

# echo "$[10 * 1024*1024*1024]" >/sys/module/zfs/parameters/zfs_arc_max
# echo 1073741824 > /sys/module/zfs/parameters/zfs_arc_max

To permanently change the ARC limits, add the following line to /etc/modprobe.d/zfs.conf.

# echo "options zfs zfs_arc_max=1073741824" >> /etc/modprobe.d/zfs.conf
# update-initramfs -u -k all

A reboot is required for the settings to take effect.

# reboot

Show memory used by ARC

# arcstat

Which should give you something similar to this :

    time  read  miss  miss%  dmis  dm%  pmis  pm%  mmis  mm%  size     c  avail
09:04:00     0     0      0     0    0     0    0     0    0  854M  999M    19G

For a detailed ZFS subsystem report, you can run the arc_summary command.

# arc_summary | less

Similar Posts