The linux swap is used like a Windows paging file. It stores memory (from RAM) that hasn't been used in some time, to free up RAM for active processes that need it. It is also used as a dump location when the system runs out of RAM so that the computer doesn't lock up entirely (though if your swap is located on a typical HDD, the system might as well be locked up since response times will drop into the minutes or longer).
swappiness is a value that tells the kernel how aggressively it should dump old memory from RAM into the swap (in other words, it defines what "old" means). Setting the swappiness to 0 prevents the kernel from ever dumping old memory onto the swap (the swap will still be used if you run out of RAM and the machine needs a dump location though).
Personally, I feel that swappiness is an outdated parameter, a remnant from when RAM was expensive and it was necessary for the OS to dump RAM data to the HDD occasionally to keep some available RAM for the occasional process that needed it. These days, RAM is so incredibly cheap that there's really no reason not to over-deliver on RAM and prevent the need for swap entirely. On all of the systems I build (as of the last 5 years or so, back when RAM prices plummeted), I install more than enough RAM to cover the requirements of the job, set up some swap space as "backup", and set swappiness to 0.
Last edited by suicidaleggroll; 10-16-2013 at 10:14 PM.