Should production servers run with swap?
AdvancedProductionPerformance & the USE Method
Answer
It depends on the workload. A small swap with low swappiness lets the kernel page out truly idle anonymous memory and gives a softer failure mode than instant OOM kills. Latency-critical services prefer predictable OOM behaviour to slow thrashing. Kubernetes historically required swap off; NodeSwap (LimitedSwap) is beta since 1.28 and requires cgroup v2. Databases like Elasticsearch recommend disabling swap or locking memory (bootstrap.memory_lock). Whatever you choose, alert on swap activity, not swap usage.
More on Performance & the USE Method
What is the USE method?BeginnerMap the USE method to concrete Linux commands.IntermediateWhat is your "first 60 seconds" checklist on a slow server?IntermediateHow do you read vmstat output?IntermediateHow do you read `iostat -xz 1`?IntermediateWhat is sar and why install sysstat on every server?Beginner