by clarry · 6y ago · 0 comments
If you can honestly answer "How much swap do I need, then?", and the answer is not infinite, then you can just add that amount of RAM instead of swap and be done with it, no need for swap, unless you want to prepare for emergency.
"Ideally you should have enough swap to make your system operate optimally at normal and peak (memory) load." Ideally you should have enough memory to make your system operate optimally at normal and peak memory load. In a perfect world, everything would fit in CPU's SRAM and you wouldn't even need DRAM..
If however you have something like kubernetes, your apps move across hosts, you have memory scaling with use (e.g connections) and you have no idea what the load on the app will be, it becomes basically impossible to right-size the memory so other strategies come into play. Monitoring becomes king at that point.
On a modern desktop system 'emergency' is every day, thanks to modern Javascript and the modern web.
Those things need infinite ram.