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?
Thread beginning with comment 337919
To read all comments associated with this story, please click here.
swap actually makes it faster.
by renhoek on Thu 20th Nov 2008 22:01 UTC
renhoek
Member since:
2007-04-29

a note for all people who do not make a swap partition because they think it will be faster :

swap space is also used to page out idle programs freeing up ram. this ram will be used as disk cache resulting in (netto) less disk io and thus higher performance.

virtual memory is one of the few things usually implemented very well on most oses. trust your os builder, he's most likely smarter than you are.

i also use the 2 times the amount of physical ram, because it's a good starting point. if you exhaust this amount of swap you need a lot more real ram. usually my swap use is around 5%, but hey, harddisk space is really cheap.

Reply Score: 2

sbergman27 Member since:
2005-07-24

virtual memory is one of the few things usually implemented very well on most oses. trust your os builder, he's most likely smarter than you are.

Indeed. On the XDMCP server I mentioned in another post, we once tried changing the /proc/sys/vm/swappiness value from the default of 60 to the oft-recommended 10. This causes the kernel to try to avoid swapping out pages until it really has to. It was a huge performance "lose". Back to 60 we went. I know from other experience that going to the other extreme, say, swappiness=90 yields pretty good results during the work day. But when everyone goes to log out at exactly 5PM... mama mia! The swap in load is killer as all those pages that are only needed at log in and log out have to be swapped back in. It often pays to trust the defaults.

Edit: Another nice thing about defaults is that they are the most well tested config. Remember that data corruption bug in ext3 several years ago that only affected people who ran with data=journal, presumably in order to be "extra safe"?

Edited 2008-11-20 22:24 UTC

Reply Parent Score: 2

6c1452 Member since:
2007-08-29

Fortunately, RAM is so cheap that you can have it both ways. I don't use swap because I don't like twiddling my fingers while I wait for formerly-idely programs to get paged back in to real memory, and there is enough left over for a disk cache (is this what system monitors refer to as the 'system cache'?).

Reply Parent Score: 1