6 ms·
How much swap space should you allocate for e.g. 16GB RAM? Every reference I've read suggests there's no need for swap space once you have more than ~2GB of RA
by Jam0864 12y ago
How much swap space should you allocate for e.g. 16GB RAM?
Every reference I've read suggests there's no need for swap space once you have more than ~2GB of RAM, but I find that extremely hard to believe.
- colanderman 12y agoI'd allocate swap on the order of how much RAM your applications use. So if they need 2 GB of RAM to be comfortable, 1-4 GB of swap will give them room to be paged out when necessary. In most situations disk space is cheap, so erring on the side of too much won't hurt.
- pizza234 12y agoI find this an interesting, common, conceptual misunderstanding. When somebody asks this question, he always thinks this way: - I have a system "A" with x GB of ram, with y GB of swap. - I have a system "B" with x+y GB of ram, and no swap, because it has all the virtual memory A is using. well, the problem is that one should not compare system B with system A, he should compare system B with system C: - I have a system "C", with x+y GB of ram, and z of swap. system C will perform potentially better than B. The generic explanation is that the kernel may decide that it's better to swap out some data, and use the space for caching purposes. This is a concept, that within limits, it's not related to the amount of RAM.
- edwintorok 12y agoAs long as 'z' is not proportional to x or y that might be fine. If you consider 'z' as a percentage of your RAM then you'll notice that your expensive server with lots of RAM is way slower than a cheap one with small RAM and smaller swap, just because it takes less time for the kernel to fill the swap and finally kill the offending process.
- Bill_Dimm 12y agoIf you plan to hibernate, I believe you need at least 16GB of swap (i.e. the amount of memory you have).
- Squarex 12y agoYou don't need swap as big as the amount of memory to hibernate. https://wiki.archlinux.org/index.php/Suspend_and_Hibernate#Hibernation https://wiki.archlinux.org/index.php/Suspend_and_Hibernate#H...