4 ms·
I have a somehow different view on swap. The issue is not swap or swap utilisation, the problem is worst case latency. Even for a database an OOM is usually be
by treffer 10y ago
I have a somehow different view on swap.
The issue is not swap or swap utilisation, the problem is worst case latency. Even for a database an OOM is usually better than a latency hit that makes it unusable slow.
As a simple example an app might start allocating and use memory in an infinite loop. How long will that take? How long will your system be unresponsive?
If you have more swap than you can write in 30s you'll most likely do it wrong (your system can be unresponsive for 60+s).
Another worst case would be allocating all memory, using it and then performing random reads throughout the memory space. Your swap to ram ratio defines how much misses and thus how much IO you are doing instead of direct memory access. This should stay way below your IO capacity.
As a result I usually try to use a small swap partition and monitor for swap-ins, not swap usage or swap out.
So that's my thinking around swap mainly due to the fact that I have seen too many servers causing issues due to swap related latency.