3 ms·
When I set up Debian on this machine (an old Proliant ML330G6 with 96Gb of memory) I did think "what do you do with swap?". In the before times, when I was a
by smackeyacky 5y ago
When I set up Debian on this machine (an old Proliant ML330G6 with 96Gb of memory) I did think "what do you do with swap?".
In the before times, when I was a SunOS/Solaris admin in the 1990s we used to have a rule of thumb handed down from the boss that swap should be 2x physical memory but in the intervening years this seems like massive overkill. The Debian installer gave it 1Gb of swap as a default. Probably not enough to get you into trouble if something decided to go truly rogue but you can always hit the off switch.
I did toy with the idea of giving it 200Gb of swap but watching the process monitor with the dev environments running and a few VMs I struggle to break 64Gb of memory usage. It is running hybrid disks and not SSDs though.
If I ever bother to put SSDs in it (unlikely) I guess I'll think about it again but swap seems almost irrelevent on a workstation now. On a server...would probably have to get a new rule of thumb.
- LeoPanthera 5y agoDon't you still need at least as much swap as RAM if you want to use hibernate? It used to be that hibernate mode simply dumped the RAM into the swap. Does it still work that way?
- smackeyacky 5y agoI don't know. The idea of hibernating a deskside server that has no sleep capability never crossed my mind. Laptops would be a different story I guess.
- rhn_mk1 5y agoIt still works this way on Linux. It's better to overprovision the swap though, if you actually intend to use it as swap at runtime. Otherwise there may not be enough free space for the hibernation.
- Dylan16807 5y agoSwap is impressively workload-dependent. I'm typing this on a Windows system with 32GB of memory and an idle swap file. What I currently have open would probably fit into 16GB. But at the same time, I have over 30GB swapped out right now. 2x physical memory is about right for my desktop, when accounting for web browsers and electron apps and other programs the soak up gobs of memory and leave that data alone for days or weeks on end. Then there's the committed but unused memory on top of that, representing another 20GB of page file I need to have just to make it happy. And then I have linux servers with 1-4 gigabytes of swap that use either none at all or a couple hundred megabytes of it.
- fhars 5y agoThere is also an architectural difference in how Linux and Solaris (at least historically) handle swap. Linux adds swap as additional memory, Solaris backs RAM with swap. So 32MB RAM plus 64MB swap give you 96MB of allocatable storage on Linux, but 64MB on Solaris. That is the origin of the "twice as much swap as RAM" rule.
- smackeyacky 5y agoThat is something I didn't realise was different about Solaris vs Linux, most interesting!