4 ms·
Can someone explain this to me? Doesn't swap just delay the fundamental issue? Or is there a qualitative difference?
by andai 1y ago
Can someone explain this to me? Doesn't swap just delay the fundamental issue? Or is there a qualitative difference?
- eru 1y agoSwap delays the 'fundamental issue', if you have a leak that keeps growing. If your problem doesn't keep growing, and you just have more data that programs want to keep in memory than you have RAM, but the actual working set of what's accessed frequently still fits in RAM, then swap perfectly solves this. Think lots of programs open in the background, or lots of open tabs in your browser, but you only ever rapidly switch between at most a handful at a time. Or you are starting a memory hungry game and you don't want to be bothered with closing all the existing memory hungry programs that idle in the background while you play.
- justsomehnguy 1y agohttps://news.ycombinator.com/item?id=45007821 https://news.ycombinator.com/item?id=45007821 > Doesn't swap just delay the fundamental issue? The fundamental issue here is what the linux fanboys literally think what killing a working process and most of the time the process[0] is a good solution for not solving the fundamental problem of memory allocation in the Linux kernel. Availability of swap allows you to avoid malloc failure in a rare case your processes request more memory than physically (or 'physically', heh) present in the system. But in the mind of so called linux administrators even if a one byte of the swap would be used then the system would immediately crawl to a stop and never would recover itself. Why it always should be the worst and the most idiotic scenario instead of a sane 'needed 100MB more, got it - while some shit in the memory which wasn't accessed since the boot was swapped out - did the things it needed to do and freed that 100MB' is never explained by them. [0] imagine a dedicated machine for *SQL server - which process would have the most memory usage on that system?
- ssl-3 1y agoIndeed. Also: When those processes that haven't been active since boot (and which may never be active again) are swapped out, more system RAM can become available for disk caching to help performance of things that are actively being used. And that's... that's actually putting RAM to good use, instead of letting it sit idle. That's good. (As many are always quick to point out: Swap can't fix a perpetual memory leak. But I don't think I've ever seen anyone claim that it could.)
- qotgalaxy 1y agoWhat if I care more about the performance of things that aren't being used right now than the things that are? I'm sick of switching to my DAW and having to listen to my drive thrash when I try to play a (say) sampler I had loaded.
- ta1243 1y agoIf I've got 128G of ram and need 100M more to get it, something is wrong. What if I've got 64G of ram and 64G of swap and need the same amount of memory?
- justsomehnguy 1y ago"Why it always should be the worst and the most idiotic scenario " And no, if you need 100MB more then it's literally not important how much RAM do you have. You just needed 100MB more this time.
- danielheath 1y agoI run a chat server on a small instance; when someone uploads a large image to the chat, the 'thumbnail the image' process would cause the OOM-killer to take out random other processes. Adding a couple of gb of swap means the image resizing is _slow_, but completes without causing issues.
- charcircuit 1y agoThe problem is freezing the system for hours or more to delay the issue is not worth it. I'd rather a program get killed immediately than having my system locked up for hours before a program gets killed.