Differences

This shows you the differences between two versions of the page.

Link to this comparison view

topics:zfs-on-linux-memory-limit [2017/03/26 04:09] (current)
orzfly created
Line 1: Line 1:
 +====== Limit ZFS on Linux Memory Usage ======
  
 +<code bash>
 +echo "​options zfs zfs_arc_max=1073741824"​ >> /​etc/​modprobe.d/​zfs.conf
 +echo 1073741824 > /​sys/​module/​zfs/​parameters/​zfs_arc_max
 +update-initramfs -u
 +</​code>​
 +
 +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.
 +
 +<code shell-session>​
 +$ apt-file search arcstat.py
 +zfsutils-linux:​ /​usr/​sbin/​arcstat.py
 +</​code>​
 +
 +<code shell-session>​
 +# 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
 +</​code>​
 +
 +<code shell-session>​
 +# 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
 +</​code>​
 +
 +===== See Alsos =====
 +  * https://​pve.proxmox.com/​wiki/​ZFS_on_Linux
 +  * https://​www.solaris-cookbook.eu/​linux/​linux-ubuntu/​debian-ubuntu-centos-zfs-on-linux-zfs-limit-arc-cache/​
 +  * http://​fibrevillage.com/​storage/​169-zfs-arc-on-linux-how-to-set-and-monitor-on-linux
 +
 +{{tag>​zfs zfs-on-linux memory}}