SSD-based file system cache

Honestly, did the installation of your operating system ever make use of the swap partition? I don’t remember that my server ever made use of it and that with as little as 256 MiB of main memory. Nowadays, memory is very cheap and if your system starts to use the swap, something is usually going wrong. Most of the time it simply means that too many processes are running, that some processes use up too much memory or that they are configured to use too much memory, mainly because they were optimized for more recent hardware.

Matthew Dillon, the leader of DragonFly BSD, revived the swap as a system-wide fast file system cache when used in combination with a solid state disk. He extended DragonFly so that not only anonymous memory (i.e. memory not backed by a file) is written to the swap in case of a low physical memory situation, but also other types of memory, especially memory used by the buffer cache. The buffer cache is repsonsible for caching data read from a device (e.g. from a hard disk). By default, all unused physical memory is used for the buffer cache, greatly speeding up reads from that device in case of a buffer cache hit. But main memory is limited. So the idea is to use a solid state disk as a secondary buffer cache. That is, when data is eleminated from the in-memory buffer cache, because new data is read and the cache is full, it is written to the secondary SSD buffer cache, which usually is much larger in size (e.g. 40-120 GiB in 2010). Solid state disks have the advantage that they are much faster when it comes to random accesses compared against rotating hard disks, which usually can’t do more than 10 MiB/sec.

Read more in this thread describing various interesting issues and take a look at the swapcache manpage of DragonFly.