zfs: tweak arc settings

This commit is contained in:
2026-03-06 13:44:07 -05:00
parent 65f5d64c1a
commit ad4d2d41fb
2 changed files with 14 additions and 5 deletions

View File

@@ -10,10 +10,17 @@
boot.kernelParams =
let
arc_gb = 32;
arc_mb = arc_gb * 1000;
arc_kb = arc_mb * 1000;
arc_b = arc_kb * 1000;
# SEE: https://github.com/openzfs/zfs/pull/15437
# and https://blog.thalheim.io/2025/10/17/zfs-ate-my-ram-understanding-the-arc-cache/
arc_max_gb = (service_configs.gb_ram * 5) / 8;
arc_max_mb = arc_max_gb * 1000;
arc_max_kb = arc_max_mb * 1000;
arc_max_b = arc_max_kb * 1000;
arc_min_gb = 4;
arc_min_mb = arc_min_gb * 1000;
arc_min_kb = arc_min_mb * 1000;
arc_min_b = arc_min_kb * 1000;
dirty_gb = 8; # Default value is 4GB, helps smooth writes
dirty_mb = dirty_gb * 1000;
@@ -21,7 +28,8 @@
dirty_b = dirty_kb * 1000;
in
[
"zfs.zfs_arc_max=${builtins.toString arc_b}"
"zfs.zfs_arc_max=${builtins.toString arc_max_b}"
"zfs.zfs_arc_min=${builtins.toString arc_min_b}"
"zfs.zfs_txg_timeout=120" # longer TXG open time = larger sequential writes
"zfs.zfs_dirty_data_max=${builtins.toString dirty_b}"
"zfs.zfs_delay_min_dirty_percent=80" # delay write throttling until 80% dirty (default 60%)