Disable ZFS ARC or limiting it

Valutin

New Member
Sep 28, 2020
10
1
3
39
Hello,
I would like to know if it's possible to disable ZFS ARC? or limiting it as much as possible and how much would be enough.
My config is that I created a mirror pool for Proxmox system and that's it. On the Rpool, only proxmox and the Windows 10/Winvirtio drivers ISO are residing. The other drives I have are directly passed through to the VMs, so besides rpool, no other disk are part of a ZFS pool. rpool is 30GB in total and already on SSD. I have a total of 32GB of RAM and would like to give as much as possible my 2 VMs. Is 512MB/1GB, min/max enough? (You might asked me why did I chose zfs... well, this is my second Proxmox setup)
I noticed yesterday that proxmox was using more than 4GB of RAM, this prevented me to run 2 VMs at 2x14GB configs. I was under the impression that Proxmox could use 1GB of RAM and since ZFS is only serving the host, I could just take the RAM off its available "RAM pool" (no pun intended)
Thanks
 

Valutin

New Member
Sep 28, 2020
10
1
3
39
Found an article about this, applied control on min and max Arc, applied 512MB and 1GB limits.
 
  • Like
Reactions: avw

jarekmor

Member
Nov 21, 2019
6
0
6
48
The documentation:

2.3.3 ZFS Performance Tips
ZFS works best with a lot of memory. If you intend to use ZFS make sure to have enough RAM available for it.
A good calculation is 4GB plus 1GB RAM for each TB RAW disk space.

3.8.7 Limit ZFS Memory Usage
It is good to use at most 50 percent (which is the default) of the system memory for ZFS ARC to prevent per- formance shortage of the host.

Use your preferred editor to change the configuration in /etc/modprobe.d/zfs and insert:
options zfs zfs_arc_max=8589934592
This example setting limits the usage to 8GB.

Note:
If your root file system is ZFS you must update your initramfs every time this value changes:
# update-initramfs -u
 

mbosma

Member
Dec 3, 2018
93
10
13
27
You can limit the arc live without reboot (not persistent) or persistent:

Set arc min and max persistent on reboots:
Code:
$ vim /etc/modprobe.d/zfs.conf
>>>
options zfs zfs_arc_max=34359738368
options zfs zfs_arc_min=17179869184
<<<
update-initramfs -u

Set arc min max realtime (non-persistent)
Code:
$ echo 17179869184>> /sys/module/zfs/parameters/zfs_arc_min
$ echo 34359738368>> /sys/module/zfs/parameters/zfs_arc_max

These examples are for 16G and 32G.
 

jarekmor

Member
Nov 21, 2019
6
0
6
48
In my home case I have 32GB RAM and 3TB of the storage and my ZFS's settings are (4GB + 1GB of RAM for each 1TB of the storage):

root@pve:~# cat /etc/modprobe.d/zfs.conf options zfs zfs_arc_min=4294967296 options zfs zfs_arc_max=8589934592

I also using following command in cronetab once a 24 hours :

echo 3 > /proc/sys/vm/drop_caches

to clear the read-cache and make the RAM available again as ZFS’s ARC (disk cache) is growing in size and Proxmox ARC is not releasing this process automatically.
 

Valutin

New Member
Sep 28, 2020
10
1
3
39
The documentation:

2.3.3 ZFS Performance Tips
ZFS works best with a lot of memory. If you intend to use ZFS make sure to have enough RAM available for it.
A good calculation is 4GB plus 1GB RAM for each TB RAW disk space.

3.8.7 Limit ZFS Memory Usage
It is good to use at most 50 percent (which is the default) of the system memory for ZFS ARC to prevent per- formance shortage of the host.

Use your preferred editor to change the configuration in /etc/modprobe.d/zfs and insert:
options zfs zfs_arc_max=8589934592
This example setting limits the usage to 8GB.

Note:
If your root file system is ZFS you must update your initramfs every time this value changes:
# update-initramfs -u
Thanks, I don't plan on adding more drives in ZFS, it's only to build a 2 men workstation, so all devices are passed through. :)
Don't forget to also set eth zfs_arc_min on the same line, because sometimes the default for zfs_arc_min is larger than the specified zfs_arc_max and ZFS will use more than you specified.
Rebooted a few times since then and it seems correctly set, always using 1024GB, Tempted to give less as the current arcsize is just 24MB, I'll let the users use the workstation first and check the arcsize in a week to further take off from it.
In my home case I have 32GB RAM and 3TB of the storage and my ZFS's settings are (4GB + 1GB of RAM for each 1TB of the storage):

root@pve:~# cat /etc/modprobe.d/zfs.conf options zfs zfs_arc_min=4294967296 options zfs zfs_arc_max=8589934592

I also using following command in cronetab once a 24 hours :

echo 3 > /proc/sys/vm/drop_caches

to clear the read-cache and make the RAM available again as ZFS’s ARC (disk cache) is growing in size and Proxmox ARC is not releasing this process automatically.
I need to read more on that, I do have another box, server side with few VMs and I only have 64GB of RAM there.
You can limit the arc live without reboot (not persistent) or persistent:

Set arc min and max persistent on reboots:
Code:
$ vim /etc/modprobe.d/zfs.conf
>>>
options zfs zfs_arc_max=34359738368
options zfs zfs_arc_min=17179869184
<<<
update-initramfs -u

Set arc min max realtime (non-persistent)
Code:
$ echo 17179869184>> /sys/module/zfs/parameters/zfs_arc_min
$ echo 34359738368>> /sys/module/zfs/parameters/zfs_arc_max

These examples are for 16G and 32G.
Thanks for the tip for the non persistent, I'll have to dig that one in.


All in all, thanks for the community help and tips. That's great help here.
 

Ovidiu

Active Member
Apr 27, 2014
309
10
38
Don't forget to also set eth zfs_arc_min on the same line, because sometimes the default for zfs_arc_min is larger than the specified zfs_arc_max and ZFS will use more than you specified.
What exactly do you mean by "on the same line"?

Something like this?

Code:
options zfs zfs_arc_min=4294967296 zfs_arc_max=8589934592
 

Dunuin

Famous Member
Jun 30, 2020
3,639
744
113
Germany
What exactly do you mean by "on the same line"?

Something like this?

Code:
options zfs zfs_arc_min=4294967296 zfs_arc_max=8589934592
Not sure if that is possible. But creating a /etc/modprobe.d/zfs.conf and adding...
Code:
options zfs zfs_arc_min=4294967296
options zfs zfs_arc_max=8589934592
...will work.
 
  • Like
Reactions: Ovidiu

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 your own in 60 seconds.

Buy now!