Linked by David Adams on Thu 20th Nov 2008 04:19 UTC
General Unix Linux and other Unix-like operating systems use the term "swap" to describe both the act of moving memory pages between RAM and disk. It is common to use a whole partition of a hard disk for swapping. However, with the 2.6 Linux kernel, swap files are just as fast as swap partitions. Now, many admins (both Windows and Linux/UNIX) follow an old rule of thumb that your swap partition should be twice the size of your main system RAM. Let us say I’ve 32GB RAM, should I set swap space to 64 GB? Is 64 GB of swap space really required? How big should your Linux / UNIX swap space be?
Permalink for comment 337928
To read all comments associated with this story, please click here.
Interesting... but don't go overboard.
by womprat on Thu 20th Nov 2008 23:11 UTC
womprat
Member since:
2008-10-30

Lets simplify the rule:

RAM + Swap space should equal or be greater than the total memory required. The more ram you install the less swap space that any OS will require!

Generally few people need more than 2-4gb swap space for a current desktop linux distro or XP/Vista. Even then only a fraction of it will be utilised.

Now days, RAM is so cheap it's little excuse to not have enough of it and it should be one's primary concern. You have enough physical ram when your OS barely needs swap space.

I recall back in the day running Windows NT servers with 4 of ram and 16mb of swap space. You could run several 2-4mb executables nicely. Ram was so fiendishly expensive swappable memory was a terrific innovation.

In some cases a swap file can be disabled if there is enough. Windows can do this, but low priority data is paged out to swapfile even on a system alot of physical ram because this optimizes shutdown and hibernate performance. It's not uncommon to disable your pagefile and watch such performance drop. Linux goes a bit nuts without at least some swap space.

If in doubt don't mess with it: Windows will do a good job of figuring out how much swap space is needed and adapt, 9/10 users should just leave it alone, infact there is little advantage in messing with it unless you want to avoid fragmentation of your swap file by using a fixed size. Linux you have to give some thought to your swap partition. Put equal sized swap partitions across all your drives, the kernel will stripe data between these for performance. Windows does a similar thing, it's a nice little performance bump in Vista if you have two drives and less than 2gb RAM.

Reply Score: 2