This is the old XigmaNAS forum in read only mode,
it will taken offline by the end of march 2021!



I like to aks Users and Admins to rewrite/take over important post from here into the new fresh main forum!
Its not possible for us to export from here and import it to the main forum!

How to get RAM free from ZFS ARC

Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
User avatar
Snufkin
Advanced User
Advanced User
Posts: 317
Joined: 01 Jul 2012 11:27
Location: Etc/GMT-3 (BSD style)
Status: Offline

How to get RAM free from ZFS ARC

Post by Snufkin »

Did inplace upgrade from two independent GEOM mirrors to one ZFS pool with two mirror vdev's.
Taking into account limited hardware resources (see signature) the result is excellent, no extra CPU load, download/upload speed drop or other side effects.

The only thing I had to face was RAM size, and here is a brief report about success.
  • FreeBSD kernel and related processes need at least 1 GB free RAM. Therefore have two sysctl tunables to set

    Code: Select all

    vfs.zfs.arc_max:1G
    vfs.zfs.arc_min:512M
    After a couple of days ZFS ARC balanced its actual working limit with at least 140 MB of free RAM (based on RRD graphs).
  • Since vfs.zfs.arc_max is not hard limit but desirable level, expect probable lack of RAM. Got it during upgrade (WebGUI).

    Code: Select all

    nas4free lighttpd[2318]: (chunk.c.581) write() temp-file /var/tmp/lighttpd-upload-hStfpL failed:
    nas4free kernel: pid 2318 (lighttpd), uid 0: exited on signal 11
  • Restarted WebGUI with

    Code: Select all

    /etc/rc.d/lighttpd restart
    and tried upgrade again

    Code: Select all

    nas4free lighttpd[6621]: (chunk.c.553) opening temp-file failed: No space left on device
    The reason is clear, in-memory /var/tmp/ is too small.
  • Found another ZFS sysctl tunable vfs.zfs.arc_free_target to define how much memory should be left free from ZFS ARC for other processes. It counts in 4096 bit blocks and default NAS4Free value is 3289 (about 13 MB). Not much (140+13=152) especially if I need to get 155 MB firmware image xz file.
  • Good news, vfs.zfs.arc_free_target tunable applies to live system and takes immediate effect. So simply raised it up to 128 MB.

    Code: Select all

    sysctl vfs.zfs.arc_free_target:32768
    and went through the upgrade without glitches.
This is ZFS ARC usage graph screenshot to illustrate above steps.
ZFS_ARC_usage.JPG
Legend:
  1. ARC releases memory too slow and lighttpd killed
  2. vfs.zfs.arc_free_target:32768 (128 MB)
  3. Successful upgrade and autoreboot
  4. New limit to test vfs.zfs.arc_free_target:16384 (64 MB)
You do not have the required permissions to view the files attached to this post.
XNAS 11.4.0.4 embedded, ASUS P5B-E, Intel DC E6600, 4 GB DDR2
ZFS 2 x HGST HDN726040ALE614, L2ARC PLEXTOR PX-128M5S

User avatar
JoseMR
Hardware & Software Guru
Hardware & Software Guru
Posts: 1058
Joined: 16 Apr 2014 04:15
Location: PR
Contact:
Status: Offline

Re: How to get RAM free from ZFS ARC

Post by JoseMR »

Hi, you can tune your ARC setting under: System|Advanced|loader.conf but a reboot is required since this setting go to "loader.conf" unlike sysctl's, also leaving 1~2 GB free from the ARC is good troubleshooting start.

You can also increase var,tmp sizes in System|Advanced|rc.conf or either "Unionfs" to a dedicated UFS formatted disk/partition(not ZFS vol), usually the Data partition the default installer creates is a good option.

However ZFS can behave really aggressive regarding the workload as well, so this is where a small Swap partition becomes in to place to help.

Regards
System: FreeBSD 12 RootOnZFS Mirror, MB: Supermicro X8SI6-F, Xeon X3450, 16GB DDR3 ECC RDIMMs.
XigmaNAS RootOnZFS
Addons at GitHub
BastilleBSD
Boot Environments Intro
Resources Home Page

User avatar
Snufkin
Advanced User
Advanced User
Posts: 317
Joined: 01 Jul 2012 11:27
Location: Etc/GMT-3 (BSD style)
Status: Offline

Re: How to get RAM free from ZFS ARC

Post by Snufkin »

JoseMR, thank you for good points to follow up and make N4F running stable.

The case I've reported is some kind of proof of concept to check whether popular beliefs about ZFS are true ot not.
  • Swap is mandatory if RAM is low
  • ZFS runs good on high grade hardware only
  • ZFS requires a huge amount of memory
And if your server usage profile is stable and predictable you could easily fine tune NAS4Free ZFS setup and not complicate things very much.
XNAS 11.4.0.4 embedded, ASUS P5B-E, Intel DC E6600, 4 GB DDR2
ZFS 2 x HGST HDN726040ALE614, L2ARC PLEXTOR PX-128M5S

User avatar
raulfg3
Site Admin
Site Admin
Posts: 4865
Joined: 22 Jun 2012 22:13
Location: Madrid (ESPAÑA)
Contact:
Status: Offline

Re: How to get RAM free from ZFS ARC

Post by raulfg3 »

Snufkin wrote:Swap is mandatory if RAM is low
yes , and always recomended neverless what amount of RAM doi you have ( better not use swap, but must be configured)
Snufkin wrote:ZFS runs good on high grade hardware only
NO , but need x64 capable system
Snufkin wrote:ZFS requires a huge amount of memory
Minimun 4GB, and 8 is recommended ( perhaps someone can use ZFS with only 2GB of RAM but need a lot of tunning to make it stable),

PD: This recomendation is true for normal ZFS, if you use deduplication , you need lots and lots of RAM to work.
12.1.0.4 - Ingva (revision 7743) on SUPERMICRO X8SIL-F 8GB of ECC RAM, 11x3TB disk in 1 vdev = Vpool = 32TB Raw size , so 29TB usable size (I Have other NAS as Backup)

Wiki
Last changes

HP T510

Post Reply

Return to “ZFS (only!)”