Table of Contents

Limit ZFS on Linux Memory Usage

echo "options zfs zfs_arc_max=1073741824" >> /etc/modprobe.d/zfs.conf
echo 1073741824 > /sys/module/zfs/parameters/zfs_arc_max
update-initramfs -u

1073741824 is 1 GiB. It is good to use at most 50 percent (which is the default) of the system memory for ZFS ARC to prevent performance shortage of the host.

Monitoring

arcstat.py is located in zfsutils-linux on Ubuntu.

$ apt-file search arcstat.py
zfsutils-linux: /usr/sbin/arcstat.py
# arcstat.py 1
    time  read  miss  miss%  dmis  dm%  pmis  pm%  mmis  mm%  arcsz     c
12:06:55     0     0      0     0    0     0    0     0    0  1005M  1024M
12:06:56    59    10     16    10   16     0    0     0    0  1005M  1024M
12:06:57    68    10     14    10   14     0    0     4   30  1005M  1024M
12:06:58    59    10     16    10   16     0    0     0    0  1005M  1024M
12:06:59    55     6     10     6   10     0    0     0    0  1005M  1024M
# arcstat.py -h
Usage: arcstat.py [-hvx] [-f fields] [-o file] [-s string] [interval [count]]
 
         -h : Print this help message
         -v : List all possible field headers and definitions
         -x : Print extended stats
         -f : Specify specific fields to print (see -v)
         -o : Redirect output to the specified file
         -s : Override default field separator with custom character or string
 
Examples:
        arcstat.py -o /tmp/a.log 2 10
        arcstat.py -s "," -o /tmp/a.log 2 10
        arcstat.py -v
        arcstat.py -f time,hit%,dh%,ph%,mh% 1

See Alsos