There are good use cases for swap. I work with very performance sensitive memory hogging applications that tend to process in bursts as incoming batched data arrives. We also have a lot of required background “security” applications.
Having the idle applications move out to swap so that a significant amount of free RAM to allow for the active, real-time applications to expand into is a major boon. RAM is expensive now, so it’s become even more critical to not waste it.
But even in self-hosting at home I take advantage of it since I have a limited number of servers with limited RAM and a bunch of applications and/or docker containers running, many of which don’t need to be active at all times, but if they were all active, would have trouble with the limited RAM. Swap allows for inactive applications to free up RAM for the active ones and leave enough available at all times to allow an application to quickly spin up new jobs.
Anyway, sure, for a simple desktop computer without a bunch of junk background applications running for “security” or whatever, and an overabundance of RAM installed, it’s probably not useful. But for high performance, memory hungry applications with lots of background stuff running, it can be a big help.
That said, there are use cases where the opposite is useful and using a RAM drive is better than writing to disk for cache and temporary logs when you have enough RAM. My opnsense router for instance uses a RAM drive to store cache and logs (logs are mirrored to the NAS for long term storage, so just the local copy is lost on reboot). That system has enough RAM and I’d rather reduce disk wear, and I don’t plan to add too many other applications to that server that it would run low.
Actually, there are more than these.
For example, hibernation and/or hybrid suspension. It’s, AFAIK, mandatory to have a swap partition to be able to hibernate and/or hybrid suspend your device.
I also found it useful to do some one-off batch processing of a big file without thinking of chunking and doing too complicated things. Imagine something like a 60GB file in a custom format that need to be deduplicated. It’s easier to just load it all up in memory and do run the algorithm 2-3x slower using a 50GB swapfile than spend hours to complicate the algorithm.
Yep. That’s why it can be nice to just have like an old 1TB drive completely used for swap. Things might get slow once it exceeds your physical memory, but at least it will eventually finish successfully – no out of memory crashes here!
There are good use cases for swap. I work with very performance sensitive memory hogging applications that tend to process in bursts as incoming batched data arrives. We also have a lot of required background “security” applications.
Having the idle applications move out to swap so that a significant amount of free RAM to allow for the active, real-time applications to expand into is a major boon. RAM is expensive now, so it’s become even more critical to not waste it.
But even in self-hosting at home I take advantage of it since I have a limited number of servers with limited RAM and a bunch of applications and/or docker containers running, many of which don’t need to be active at all times, but if they were all active, would have trouble with the limited RAM. Swap allows for inactive applications to free up RAM for the active ones and leave enough available at all times to allow an application to quickly spin up new jobs.
Anyway, sure, for a simple desktop computer without a bunch of junk background applications running for “security” or whatever, and an overabundance of RAM installed, it’s probably not useful. But for high performance, memory hungry applications with lots of background stuff running, it can be a big help.
That said, there are use cases where the opposite is useful and using a RAM drive is better than writing to disk for cache and temporary logs when you have enough RAM. My opnsense router for instance uses a RAM drive to store cache and logs (logs are mirrored to the NAS for long term storage, so just the local copy is lost on reboot). That system has enough RAM and I’d rather reduce disk wear, and I don’t plan to add too many other applications to that server that it would run low.
Actually, there are more than these. For example, hibernation and/or hybrid suspension. It’s, AFAIK, mandatory to have a swap partition to be able to hibernate and/or hybrid suspend your device.
Its a meme built on stuff like this:
https://gist.github.com/joshenders/c4960cec9c63a7b7d68ffa9543356c43
I also found it useful to do some one-off batch processing of a big file without thinking of chunking and doing too complicated things. Imagine something like a 60GB file in a custom format that need to be deduplicated. It’s easier to just load it all up in memory and do run the algorithm 2-3x slower using a 50GB swapfile than spend hours to complicate the algorithm.
Yep. That’s why it can be nice to just have like an old 1TB drive completely used for swap. Things might get slow once it exceeds your physical memory, but at least it will eventually finish successfully – no out of memory crashes here!