Interview Prep/Linux/Performance & the USE Method

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.

All Linux questions Roadmap: Linux

More on Performance & the USE Method