My coworker just pointed me in the direction of this document. This is, I believe, the MOST USELESS tutorial of all time. It highlights using the system’s RAM as a swap partition, by zeroing a swapfile in /dev/shm and then mkswap’ing it.

I ask, what’s the point of swap? Well, it’s an “overflow reservoir” if you will, storing memory pages on disk when RAM is full. It’s stored on disk because disk space is cheap, but memory space is not. So swap only really gets used when RAM is full. So if you put a swap file in RAM… what the hell did you accomplish? There’s no performance gain to be seen whatsoever! The only effect is that now you have the overhead that results from storing files, which means LESS RAM available for applications.

The really funny part is how the author claims he saw significant performance gains. The number of comments saying, “great idea!!!” is just unbelievable as well.

If you’re thinking to yourself that it may be useful since really old pages get swapped even though they could potentially fit, I point you to the kernel proc parameters. Running “sysctl vm.swappiness=0” will make the kernel swap as infrequently as possible without causing issues with your running applications. The default value of this parameter is (usually) 60.

Anyway, here’s the link. Read it for the facepalm… you should have a handprint on your forehead afterwards if you read it correctly.

Link: http://kerneltrap.org/node/3660