4 ms·
> It used to be that the recommendation for swap was 2x ram. It always boiled down to never allocate more swap than you're willing to wait, and memory capacity
by VLM 6y ago
> It used to be that the recommendation for swap was 2x ram.
It always boiled down to never allocate more swap than you're willing to wait, and memory capacity multiplied over the years far faster than real world drive thruput.
So I was willing to slow everything down to use 8 megs of swap in 1994 in order to have enough virtual memory to compile a kernel, and in 2021 I'm still willing to slow everything down to use 8 megs of swap, in fact drive thruput has maybe quintupled since then, maybe, so I'd be willing to slow my system down into using 32 megs of swap in 2021.
The problem is 8 megs of swap in 1994 dramatically increased my horizons and I could use it to compile the kernel and stuff like that. In 2021, 32 megs of swap just makes my web browser OOM kill about 100 milliseconds later so why bother?
- stouset 6y agoAs I understand it, swap is used even when the system isn’t under direct memory pressure. If the kernel sees that some memory is barely, if ever used, it will swap it out preemptively. This gives you more memory available for both programs and temporary caches. As such it’s still advantageous to add much more swap than this, since it effectively gives you extra free space in RAM at essentially no cost.