← ClaudeAtlas

infra-swap-tuninglisted

Use when deciding a Linux host's swap configuration - whether to add zram compressed swap, what size, what swap priority, and what vm.swappiness to set - or when a host froze with the kernel still alive (ping answers, cluster membership holds, TCP connects succeed) while sshd never completes a banner and every container userland is stuck, especially with swap on a ZFS zvol. Covers measuring compressibility and pressure before choosing numbers rather than applying a general recommendation.
bitranox/bitranox-skills · ★ 1 · DevOps & Infrastructure · score 57
Install: claude install-skill bitranox/bitranox-skills
# infra-swap-tuning ## Overview Swap tuning advice is written for general-purpose servers. On a hypervisor the anonymous memory is mostly GUEST RAM, which breaks the assumption every recommendation rests on. Measure the two inputs that decide the numbers, then set them. **Core principle: the compression ratio of the memory that would actually be swapped decides whether swapping is cheap. Measure it. Do not assume it.** ## The freeze this prevents Swap on a ZFS zvol is a deadlock: under pressure the kernel must page out, paging out re-enters ZFS, and ZFS needs memory to finish. The result is not an OOM kill but a total userland stall. Recognise it by what still WORKS: | Still alive | Frozen | |-----------------------------------------|------------------------------------------| | ICMP (answered in softirq) | sshd - accepts TCP, never sends a banner | | corosync / cluster membership (RT prio) | every container's userland | | TCP connect (kernel accept queue) | all VMs | | the kernel | anything needing an allocation or fork | A container answering ping proves nothing: for a veth guest the HOST kernel replies. Test guest userland with a real ssh login, not ICMP. **The local journal will be empty.** journald writes through the same stalled path, so it stops mid-operation with nothing logged. Look for network-shipped