Swap lets Linux move rarely-used memory pages to disk so RAM can serve active work. A small, stable amount of used swap is harmless.
Trouble starts when the server actively swaps: disk is orders of magnitude slower than RAM, so response times explode and load climbs. Persistent swap growth is the early warning that memory is undersized or something leaks — and if RAM truly runs out, the kernel’s OOM-killer starts terminating processes, MySQL being a favourite victim.
Frequently asked questions
Is using swap always bad?
No — parked, unused pages in swap are fine. The bad sign is continuous swap in/out activity (thrashing) while the server feels slow.
What is the OOM-killer?
When memory and swap are exhausted, the kernel kills the process using the most memory to keep the system alive — often the database. The fix is more RAM or finding what eats it.