9 ms·
> If it can't swap, it pretty much just dies. The point with my example was that if 512 MB of swap would save you, then why wouldn't 8 GB of extra RAM save you
by dkersten 7y ago
> If it can't swap, it pretty much just dies.
The point with my example was that if 512 MB of swap would save you, then why wouldn't 8 GB of extra RAM save you?
Yes, if you run out of RAM, you're in trouble, but if you run out of RAM+swap you're in trouble too, so what's the point in adding a small 256 or 512 MB swap?
Ok, so the point is that its visibly bad with swap before it actually dies, giving you time to recover. How about setting up some kind of alert when you're in your last half a gig or gig of RAM then? It seems like this would give a much better recovery experience. If its a server, you need an alert anyway since you're not going to notice the bad performance until its too late, most likely (you're not watching it 24/7 I assume).
Of course, from the article:
> I stand by my original position: have some swap. Not a lot. Just a little. Linux boxes just plain act weirdly without it.
That's fair enough, if the reason is to stop linux from acting weirdly, then fine.
- masklinn 7y ago> The point with my example was that if 512 MB of swap would save you, then why wouldn't 8 GB of extra RAM save you? Having 8 GB more RAM might avoid the issue, but it won't visibly degrade the system so you will not see that you're in trouble. And again if you can have both, have both. > Yes, if you run out of RAM, you're in trouble, but if you run out of RAM+swap you're in trouble too, so what's the point in adding a small 256 or 512 MB swap? Because if you run out of RAM and have no swap, the system dies. If you run out of RAM and have swap, it starts swapping, which is noticeable. > How about setting up some kind of alert when you're in your last half a gig or gig of RAM then? It seems like this would give a much better recovery experience. If its a server, you need an alert anyway since you're not going to notice the bad performance until its too late, most likely (you're not watching it 24/7 I assume). If it's a server you need to do that anyway because the swapping will probably not be noticeable.
- isostatic 7y ago> Because if you run out of RAM and have no swap, the system dies. If you run out of RAM and have swap, it starts swapping, which is noticeable. Only if you're using the system, or are reacting to monitoring (if you can monitor it and the thing you're monitoring fails) fast enough I'd rather have a dead system than one that's not working But in any case shouldn't OOM killer come to the rescue?
- dkersten 7y ago> But in any case shouldn't OOM killer come to the rescue? Indeed. Its similar to the argument that segfaults are good due to fail fast. Wouldn't it be better to fail fast due to OOM than to hobble along? If you're actively using the system, ok, you might get a chance to save your work or whatever first, but, in my personal anecdotal experience, that process is pretty much dead anyway and I have to kill it. Yes, my system doesn't get taken down, but if OOM takes the system down, why isn't the kernel killing the process that's eating all the memory? It sounds to me that swap is just masking the problem.
- masklinn 7y ago> I'd rather have a dead system than one that's not working A swapping system is degraded, not "not working". > But in any case shouldn't OOM killer come to the rescue? The OOM killer will heuristically kill random crap. It could be the process with an unbounded memory growth, or it could be your text editor.