Yet another SWAP question: Should I resize?
I know this topic has been disucssed to death and that there is no one truly optimal SWAP size for any case, but hear me out.
I have nearly 3gb RAM and a 250gb hard disk on my Lenovo laptop, running Ubuntu 10.04 LTS. Being a newbie, I chose the default install option, and the installer set up an 8gb SWAP space. That's nearly 3xRAM. I am asking because I've been reading that in the old days, when RAM was more scarce, the swap should be 2xRAM, but currently I believe I have plenty of RAM and that the SWAP should be 2xRAM at best. Code:
free -m Is there a likely gain from choosing SWAP of, say, 5gb? |
The 2xRAM rule of thumb is way outdated. If you would need so much RAM that it would need 6GB (or even the 8GB given to you by the installer) of swap to run your workload the machine would be slow as hell. On a normal desktop machine (which includes laptops) 1-2GB should be more than sufficient, unless you want to use hibernate. In that case the swap partition should be at least the size of your physical RAM.
6 or more GB would simply be a waste of space. |
Do you use Hibernation? The usual size of swap is the same as RAM so yours could be 3Gb, Even when it shows a lot of RAM in use there is a lot cached too so all good and there is no swap in use at all! How about your partitions space? Are things getting too big and space too small?
Regards |
Quote:
How important is that to you? Do you have a 250GB drive because you need that much? Or do you need much less than that and have it because that is what was convenient to buy? Or do you need more than that and upgrading is inconvenient and you frequently move things to offline storage because you are out of space? Next question, what is the downside of reducing swap from 8GB to 5GB. That amount of swap is basically insurance. In case of software memory leak, things slow down smoothly and let the problem be more easily diagnosed, rather than failing sooner in a harder to diagnose way. In case you start running certain unlikely large tasks, your system can handle it (maybe slowly) rather than fail. All very unlikely. I don't know how you use your system. For ordinary use with your system specs the upside of reducing your swap size is small and the downside smaller. Basically, don't care. |
@ TobiSGD
I never use hibernation and I'm just a regular desktop user, so clearly I'm wasting space here. Just hoping it's not affecting the performance. @ ukiuki Are you saying that my SWAP could be 3gb even though free -m shows 8gb? I only have the SWAP and the root partition, and I haven't noticed anything unusual, yet. |
Quote:
But it's good to know that excessive SWAP only means less storage and not decreasing performance. Then I won't be losing much sleep because of this. But I'm still wondering why Ubuntu installer would assign so much SWAP in the first place. |
Quote:
|
Quote:
I'm guessing the Ubuntu installer looked at how much ram is physically present, rather than how much ram the about to be installed kernel would be able to use, then it applied the stupid old rule of 2xRAM for swap. Always was a stupid rule, even stupider now, but lacking any non stupid rule, what is a distribution install supposed to default to. BTW, my guesses tend to be pretty good, but I wouldn't have said "guess" if this post had the level of confidence of my typical answers. The less generally known fact that went into those guesses is that DMI information about how much ram is physically present is easy to read and totally independent of how much ram the motherboard or BIOS or kernel actually allow you to use. |
All times are GMT -5. The time now is 10:18 AM. |