4 ms·
Every commercial job I’ve had has had swap set to zero. We’d rather run out of memory than swap.
by netik 4y ago
Every commercial job I’ve had has had swap set to zero. We’d rather run out of memory than swap.
- hulitu 4y agoI bet it was never boring.
- nomel 4y agoIn every commercial setting I’ve been involved with, something has gone very wrong if you’re swapping, since you spec the system for the use case, rather than a fraction of it. You’ll still have the logs to debug whatever went wrong. What problems do you see?
- Arnavion 4y agoYes, exactly. If your machine is starting to use swap, then it's already running away on memory that you hadn't planned for. The swap just delayed the inevitable OOM. You might as well let it OOM immediately.
- VectorLock 4y agoFail fast is in most situations better than swap hell.
- whartung 4y agoIndeed. As a Java shop, the last thing you want to do is swap. Garbage Collection and Swap tend to be very bad cohabitants.
- kevincox 4y agoYeah, no swap probtnakes sense for GCed languages. If you are going to touch all of the memory frequently it doesn't make sense to try to swap it out. You are better off forcing Linux to swap out filesystem cache which at least has a chance of not being used in the next minute. The only real thing that you may be missing is SSH being swapped out and some other system processes but those may be 2MiB altogether. Maybe an option would be disabling swap just for the JVM. IDK if that is something you can do with cgroups. But if 99% of your anonymous RAM is pinned anyways there is little to gain.
- xani_ 4y agoWe use it as early alert to give more RAM. Just like a gig of swap per server regardless of RAM size.
- orev 4y agoSwap space is used for many other things than just running out of memory. Given the huge number of comments on this post that get it wrong so badly, I'm not going to respond to all of them, so please do your own research. The short answer is that not having swap causes the system to run with one hand tied behind its back, since it’s forced to store unused/rarely used stuff in RAM, taking up space that could be used more productively (like disk cache).