Software rec – How can I use my small SSD as a cache for a larger hard disk?

I would like to use a (small) SSD disk as a cache for a large hard disk. I realize there are hardware-based products that do this: HighPoint RocketHybrid HBA, Intel SmartResponse and others. There is only one software-only product that I could find: ExpressCache by Diskeeper:

ExpressCache intelligently and automatically combines the best attributes of SSDs and HDDs without any effort or pre-requisite knowledge from the user, so users get the best of both worlds; dynamic performance and scalable capacity. Since SSDs as small as 4GB can be used, it provides an incredibly affordable solution for manufacturers.

Comprised of User mode and Kernel Mode components, ExpressCache uses the SSD as an intelligent cache, coupled with an HDD, to improve overall system performance and greatly speed up Windows PC startup, application launches and data access speed.

However, this product is OEM only!

I looked for alternatives, without any success… I cannot understand this: It sounds like a great idea, no additional hardware is needed, and it could really boost the disk performance without spending a fortune.

So, I’m asking if anyone knows any software that does this, either for Windows or Linux. Or if you think this is a bad idea, I’d like to know why.

Note: ReadyBoost is not really suitable for this. It is built with the assumption that disk writes are really expensive, has very little effect on systems with plenty of RAM, and does not scale properly if your SSD is 100GB+.

Solution:

There are several ways to use an SSD as a cache for your regular hard drive. This is not a new idea, and already has several implementations.

In Windows:

The best implementation is by NVelo: Dataplex – It has read caching and optional write caching. Unfortunately, like ExpressCache it is available to OEMs only. The cheapest way to get it is to buy an OCZ SSD which packages a PCIE adapter with a small SSD and uses the dataplex software to cache your existing harddrive.

There are however, pure software implementations too: FancyCache – It works like you might expect performing read and write caching at the block layer. It primarily exists as a memory cache, but recently has gained support for a second layer SSD cache (a bit like the ZFS L2ARC), which can be arbitrarily large.

If you are just looking to max out on IOPS at the cost of write durability (perfectly fine in conjunction with a UPS for example), an alternative might be something like: SuperCache – This will use RAM only, no SSD. But unlike the others, will happily exceed 100,000 IOPS on commodity hardware. Very useful for caching the block device containing database indexes for example. Essentially giving RAM-Disk like performance for any sized volume (assuming the underlying device can keep up with the write volume).

In Linux, things are a bit nicer:

As a previous poster mentioned, you have Flashcache – It works rather well, but its performance varies greatly with your workload. In many cases with poor access locality it will not perform as well as you might expect. Not sure why that is, but for most workloads this is a great option.

The best option (though the code is still not quite “production ready”) is bcache (more information here, though some of if is outdated) – It has the best performance of any SSD cache I have yet tried, and unlike all the other options mentioned supports caching multiple block devices on a single cache. It also supports (though I haven’t personally tried this, it may not work yet) multiple cache devices, so you can use multiple cheaper SSDs for maximising your IOPS. The code is in a git repository: git://evilpiepirate.org/~kent/linux-bcache.git. There is talk of merging it into the next kernel release, though it hasn’t yet been decided for sure.

Personally I find the best performing option is bcache (my workload is mostly database related, though I also cache my main laptop in its entirety). In my experience the sequential write throughput of the HDD is often the bottleneck, as the cache fills up fast and the HDD needs to write the cached sectors, so the faster the better. This is of course for a write heavy workload, in a more balanced read-write workload things will likely be different.

I should also warn you, that at full speed, you will burn through the write limits of your SSD fairly quickly. I’m currently on my third OCZ Vertex 3. SSDs though very very fast, are simply not very durable, so expect to replace them every few months.