3 ms·
The rule of thumb (swap should be 2-3x RAM) has survived because it has minimal downside (you don't generally miss that amount of disk) and a small upside (you
by jbert 18y ago
The rule of thumb (swap should be 2-3x RAM) has survived because it has minimal downside (you don't generally miss that amount of disk) and a small upside (you see performance degradation as the first symptom of memory overloading, rather than processes dying due to failed allocations).
Yes, if you know your workload very well, you can trim off the spare space and make it smaller. But the risk you run is that a change in circumstances will make itself known by failing jobs, rather than slow-running jobs. And the benefit you gain is very small.
A keen sysadmin could also trim swap down, if they're sure they'll notice warnings early enough in the event of a problem.
(This assumes 'normal' amounts of disk+RAM in a box (i.e. diskspace at least two orders of magnitude bigger than RAM, so you're sacrificing of the order or 2-3% diskspace). Unusual devices might reasonably make different tradeoffs).