1 { pkgs, lib, config, ... }:
5 algorithm = lib.mkDefault "zstd";
6 memoryPercent = lib.mkDefault 50;
7 # Linux supports multithreaded compression for 1 device since 3.15.
8 # See https://lkml.org/lkml/2014/2/28/404 for details.
9 swapDevices = lib.mkDefault 1;
12 boot.kernel.sysctl = {
13 # Increase cache pressure, which increases the tendency of the kernel to
14 # reclaim memory used for caching of directory and inode objects. You will use
15 # less memory over a longer period of time. The performance hit is negated by
16 # the downside of swapping sooner.
17 "vm.vfs_cache_pressure" = lib.mkDefault 500;
19 # Increasing how aggressively the kernel will swap memory pages since we are
21 "vm.swappiness" = lib.mkDefault 100;
23 # Background processes will start writing right away when it hits the 1% limit
24 "vm.dirty_background_ratio" = lib.mkDefault 1;
26 # The system won’t force synchronous I/O until it gets to 50% dirty_ratio.
27 "vm.dirty_ratio" = lib.mkDefault 50;