1 # Warning(perf): using zswap is almost always better, see:
2 # https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-what.html
8 algorithm = mkDefault "zstd";
9 # There is little point creating a zram greater
10 # than twice the size of memory.
11 memoryPercent = mkDefault 150;
12 # Linux supports multithreaded compression for 1 device since 3.15.
13 # See https://lkml.org/lkml/2014/2/28/404 for details.
14 swapDevices = mkDefault 1;
17 boot.kernel.sysctl = {
18 # Increase cache pressure, which increases the tendency of the kernel to
19 # reclaim memory used for caching of directory and inode objects. You will use
20 # less memory over a longer period of time. The performance hit is negated by
21 # the downside of swapping sooner.
22 "vm.vfs_cache_pressure" = mkDefault 500;
24 # Increasing how aggressively the kernel will swap memory pages since we are
26 "vm.swappiness" = mkDefault 100;
28 # Background processes will start writing right away when it hits the 1% limit
29 "vm.dirty_background_ratio" = mkDefault 1;
31 # The system won’t force synchronous I/O until it gets to 50% dirty_ratio.
32 "vm.dirty_ratio" = mkDefault 50;