What is it?

autoswap creates swapfiles based on either a percentage of system RAM or an admin requested amount. It is designed to be run at boot time via the init scripts.

Why would I want it?

Well, I wrote it because I run a cluster of machines which have different RAM and disk sizes, and I wanted to be able to more easily run the same OS image on them (in the tradition of the Infrastructures.org bootstrap paper. Having the computer figure out the details made sense to me.

What about swapd?

I tried swapd first, but it has a flaw that made it not useful for me. If the system is under high load, and starts to run out of memory, swapd wakes up and creates more swap. This is fine, but the problem is that creating more swap is a lot of IO, and it happens right when the system is already heavily loaded. This caused problems at my site. Creating the swapfiles in advance doesn't have this problem, and frankly, disk is cheap and plentiful, and leaving 2GB or so of swapfile around is not a big deal.

autoswap also has the (very small) advantage that it's not a daemon, so less chance of security exploits and no runtime overhead.


Many thanks to Linden Lab, for letting me release this and for letting me work on open source on company time.

ferlatte at cryptio dot net