zfs_arc_max does not seem to work

The zfs_arc_max value must be provided as a HEX value. More information here: http://www.thezonemanager.com/2009/03/filesystem-cache-optimization.html

root@game:/mnt/pve/nfs/tools# cat calc_arc.sh
#!/bin/bash
numGigs=$1
decVal=$((${numGigs}*(2**30)));
HEXVAL=`echo "obase=16;ibase=10; ${decVal}" | bc`
echo "0x${HEXVAL}"

root@game:/mnt/pve/nfs/tools# ./calc_arc.sh 8
0x200000000

root@game:~# grep arc_max /etc/modprobe.d/zfs.conf
options zfs zfs_arc_max=0x200000000

root@game:~# cat /proc/spl/kstat/zfs/arcstats | grep c_max
c_max 4 8589934592

root@game:~# arcstat.py 5 5
time read miss miss% dmis dm% pmis pm% mmis mm% arcsz c
23:14:05 0 0 0 0 0 0 0 0 0 19M 8.0G
23:14:10 5.1K 5.0K 98 5.0K 98 0 0 2.7K 97 10M 8.0G
23:14:15 2.8K 2.7K 97 2.7K 97 0 0 1.9K 96 9.2M 8.0G
23:14:20 3.0K 2.9K 98 2.9K 98 0 0 1.9K 97 22M 8.0G
23:14:25 318 306 96 306 96 0 0 269 95 13M 8.0G
 
Maybe by now (2016) both formats (Dec and HEX) might be supported with newer versions?

I am just looking at a Proxmox 4.2 (test) installation, upgraded from former 3.x where this is set up (and working as far as I can see) with decimal:

cat /etc/modprobe.d/zfs.conf
options zfs zfs_arc_max=2149983648

cat /sys/module/zfs/parameters/zfs_arc_max
2149983648

arcstat.py
time read miss miss% dmis dm% pmis pm% mmis mm% arcsz c
13:46:05 0 0 0 0 0 0 0 0 0 2.0G 2.0G
 
Side note, trawling through old archived useful info here. Yes, decimal is supported now.

Secondly, if you use the echo command to change live size, you must drop the caches to allow them to repopulate with the new size. This may thrash your disk if a lot of reads from cache were happening and wont be for a little while.

I answered this question here:

https://serverfault.com/questions/5...etting-honoured-on-zfs-on-linux/833338#833338

summarized in case serverfault disappears someday:


Once you modify your arc size, you need to drop your caches.
echo 3 > /proc/sys/vm/drop_caches

and wait for the caches to unload, and then see lower performance as reads come off disk to repopulate.

Clear PageCache only: # sync; echo 1 > /proc/sys/vm/drop_caches
Clear dentries and inodes: # sync; echo 2 > /proc/sys/vm/drop_caches
Clear PageCache, dentries and inodes: # sync; echo 3 > /proc/sys/vm/drop_caches
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!