6 ms·
Only if you have more RAM than disk space, which is wasteful for many applications.
by akvadrako 11mo ago
Only if you have more RAM than disk space, which is wasteful for many applications.
- adastra22 11mo agoRunning out of memory kills performance. It is better to kill the VM and restart it so that any active VM remains low latency. That is my interpretation of what people are saying upthread, at least. To which posters such as yourself are saying “you still need swap.” Why?
- eru 11mo agoRAM costs money, disk space costs less money. It's a bit wasteful to provision your computers so that all the cold data lives in expensive RAM.
- adastra22 11mo agoWhen building distributed systems, service degradation means you’ll have to provision more systems. Cheaper to provision fewer systems with more RAM.
- eru 11mo agoIt depends on what you are doing, and how your system behaves. If you size your RAM and swap right, you get no service degradation, but still get away with using less RAM. But when I was at Google (about a decade ago), they followed exactly the philosophy you were outlining and disabled swap.
- fluoridation 11mo ago>It's a bit wasteful to provision your computers so that all the cold data lives in expensive RAM. But that's a job applications are already doing. They put data that's being actively worked on in RAM they leave all the rest in storage. Why would you need swap once you can already fit the entire working set in RAM?
- eru 11mo agoSure, some applications are written to manually do a job that your kernel can already do for you. In that case, and if you are only running these applications, the need for swap is much less.
- fluoridation 11mo agoYou mean to tell me most applications you've ever used read the entire file system, loading every file into memory, and rely on the OS to move the unused stuff to swap?
- eru 11mo agoNo? What makes you think so?
- fluoridation 11mo agoThen what do you mean, some applications organize hot and cold data in RAM and storage respectively? Just about every application does it.
- eru 11mo agoA silly but realistic example: lots of applications leak a bit of memory here and there. Almost by definition, that leaked memory is never accessed again, so it's very cold. But the applications don't put this on disk by themselves. (If the app's developers knew about which specific bit is leaking, they'd rather fix the leak then write it to disk.)
- fluoridation 11mo agoThat's just recognizing that there's a spectrum of hotness to data. But the question remains: if all the data that the application wants to keep in memory does fit in memory, why do you need swap?
- KaiserPro 11mo ago> Running out of memory kills performance. It is better to kill the VM and restart it so that any active VM remains low latency. Right, you seem to be not understanding what I'm getting at. Memory exhaustion is bad, regardless of swap or not. Swap gets you a better performing machine because you can swap out shit to disk and use that ram for vfs cache. the whole "low latency" and "I want my VM to die quicker" is tacitly saying that you haven't right sized your instances, your programme is shit, and you don't have decent monitoring. Like if you're hovering on 90% ram used, then your machine is too small, unless you have decent bounds/cgroups to enforce memory limits.