PrimoCache

Posted on

Here’s another interesting piece of software that you probably wouldn’t have heard of. Something called PrimoCache that implements an additional layer of caching between your operating system and hard drive. Now the observant among you will point out that Windows already has a file cache, and having two of them is just inefficient, which is true. The important point isn’t what PrimoCache does, it’s how it does it’s caching.

Windows uses a file level cache. Files are cached in blocks of 256KB, so if a file is only 4KB then the rest of the block is empty. More importantly, there are a lot of processes that bypass the cache completely. For example VLC and the default configuration of Virtualbox both use un-cached reads from the hard drive. MySQL also ignores the disk cache under the assumption that it’s own cache is sufficient. The issue arises when you have usage patterns that would hugely benefit from forcing all operations to go through the file cache. In general, there are situations where the computer assumes that some files won’t be read twice, but you know that they will. During standard Windows 10 usage (web browsing), I got a 32% cache hit rate with a 300MB cache.

PrimoCacheHitRate

It works the same for writes. If you’re writing data out to a file, then you need to close and flush the file handle before the process that’s doing the write terminates, or else you end up with a half written file. Many programming languages will automatically flush out the data and close off the handle if you forget (Python), but some won’t (C#, Perl). The problem with this is that flushing out a file’s write cache to disk can impact the entire system so if one process is writing out to its log files this behavior will cause a performance hit for all other processes on that machine, even if that process is only writing a few lines at a time. PrimoCache can smooth out this behavior by standing between processes and the disk exactly like Windows’ own write cache, but with user control. From the perspective of the programs, their writer operations will all occur at full speed and not affect one another, while PrimoCache will write out the stored blocks onto the disk when no writes are being requested from that drive (or the cache fills up).

Do I recommend this for general use? Not really, it’s probably too inefficient to have multiple stacking caches. However it’s worth knowing this software exists if you’re doing something like music recording or something else that demands data be written to disk without interference.

If you didn’t have to specify the size of the cache beforehand and it scaled dynamically, this would be something I’d be very impressed with, otherwise the software remains a niche-product.

Why not just get an SSD? That’s a non-solution. Any problem can be solved just by throwing money at it and that’s assuming that getting an SSD is even anĀ  option for the machine in question. The ideal solution to any problem will solve the requirements as cheaply as possible, something that directly relates to my previous post about TCP-IP settings.

Leave a Reply

Your email address will not be published. Required fields are marked *