ReadyBoost for Linux?
Just wondering if there is something like ReadyBoost for Linux.
As I understand it, there are 2 parts to ReadyBoost. The first part is using the solid state memory as swap. That is easily doable in Linux (just move swap to flash drive), and I don't think it helps, given sufficient amount of real RAM. People have also pointed out that it's just marketting hype.
The second part is much more interesting. Windows can use flash drives as some kind of persistent disk cache. This allows fast random access to small files. Solid state memory can service these requests much faster than harddrives, thanks to their almost 0 latency. Harddrives have average latencies of at least 10ms. For this kind of access, the higher throughput of harddrives don't really help.
If we do the math, assuming latency is 10ms, and throughput is 70MB/s for harddrive, and 0ms, 20MB/s for flash drives,
Access time for harddrive = 0.01 + s/70
Access time for flash drive = s/20
The 2 lines intersect at about s = 280KB.
That means, for file accesses less than 280KB, flash memory can do it faster. I believe most file accesses fall under this category (writing to log files, loading icons, getting directory contents, browser caches, emails, booting, etc).
Many people have reported that Windows boot times are significantly reduced on a SSD (even ones that have close to or lower throughput than HDs), which supports this hypothesis. This may be an extreme case, however.
On the Linux side, the disk caching system already does this, somewhat. There are a few shortcomings as I see it (compared to using flash memory for caching) -
1.) Disk caches are cleared by reboots, and many people need to reboot their machines frequently (eg, laptops, to save power).
2.) Accessing large files causes the whole disk cache to be flushed. Subsequent accesses to small files need to go through the disk. The disk caching system, as far as I can tell, doesn't distinguish between big and small files.
3.) Harddrives need to be spun up for fsync(), and also for committing to journals.
A smart implementation of flash memory caching can solve all 3 problems. It shouldn't replace the DRAM cache, of course. I think it should sit between the DRAM cache and the disk.
Assuming an implementation doesn't already exist, where should this be implemented?
As a FUSE driver? as a kernel module?
What do you think?