4 ms·
When you have 256 gigabytes of RAM 8 gigs of swap isn't going to move the needle on OOM and it will put you at risk of having things you didn't want swapped out
by arielweisberg 8y ago
When you have 256 gigabytes of RAM 8 gigs of swap isn't going to move the needle on OOM and it will put you at risk of having things you didn't want swapped out swapped preemptively. At various points in history Linux would swap out your application in favor of cached filesystem data even with kernel tunables set appropriately. This may have changed, it may not, but who cares because swap just isn't that useful when you have a lot of RAM.
Also swap on spinning disk is 100% pointless in most cases and many servers are still on spinning disk only as is appropriate for their usage.
On a server running data intensive applications you generally have your memory divided pretty cleanly into scratch space and working set you absolutely don't want swapped out, and data on disk that is swapped out either via a buffer pool or the page cache. The application manages which category memory utilization falls into in order to ensure consistent performance and to avoid things like event loop threads blocking on swap or threads holding locks blocking on swap.
Swap works great on desktops now that SSDs are a thing and it regularly cleans up after messy applications on my MacOS laptop. Compressed memory is also great. Granted performance on my Mac is abysmal, browser tabs take seconds to open and accept input, apps need to warm up after a context switch, but it beats opening and closing stuff constantly.