What is the Hard Drive Cache and What Does It Do?
PCs are complicated machines, filled with dozens of smaller components, all working together. Anyone who’s worked with PC hardware is familiar with the main hard drive specs, like capacity, read/write speeds, and platter rotation speeds. However, there is a lesser-known and often overlooked feature that impacts the speed and performance of your hard drive. The feature is known as the hard drive cache. Let’s take a quick look at what hard drive cache and SSD cache is, and how it works.
What Is Hard Drive Cache?
Hard drive cache is often known as the disk buffer. By that name, its purpose becomes a little c. It acts as a temporary memory space while the hard drive reads and writes data to the permanent storage on the platters.
You can think of a hard drive’s cache as being like random-access memory (RAM) that is specifically designed for the hard drive. Hard drives have built-in microcontrollers that govern and process data coming in and out, much like a CPU. The cache works in conjunction with the microcontroller to store memory as it’s being processed.
You can also think of hard drive cache as something similar to buffering when it comes to streaming content. Everyone has dealt with streaming a video on a slow connection. The video player waits before or during playback to collect data so that it can continue playing the video more smoothly as it progresses. Hard drive cache allows a hard drive to do the same thing when reading and writing data.
How Does It Work?
As the hard drive reads and writes data, it pulls it from the platters. Very often, a hard drive is working with the same data repeatedly, since the person using the computer is usually working on one or two tasks at a time. The hard disk drive (HDD) holds data in its cache that you or your programs are using most frequently and, most recently, eliminating the need to pull it from the platters each time that the data is needed. This action speeds up the drive’s performance.
Reading Ahead and Behind
Typically, a hard drive doesn’t just pick up the data that it needs. It also reads the data around it. Hard drives aren’t efficient. The spinning platters and read/write heads are inherently limited by physical moving parts, which are much slower than solid-state drives that have no moving components. Therefore, hard drives try to compensate by guessing.
When a user or a program requests data (reminds me of Tron), the hard drive reads that data and the data around it from the platter and stores it all in the buffer. Since there is a decent likelihood that the surrounding data is similar, the drive assumes that the user or process will also request the surrounding data soon.
Evening Data Flow
There are a bunch of different steps to retrieving data from a hard drive. Each one of them takes time, and they rarely sync up. Transferring data from the hard drive via SATA usually moves much faster than the drive can read and write data to the platters. The disk buffer is often used to even out this flow of data and make the process much smoother.
Minimizing Wait Times When Writing
Again, hard drives are slow. They are probably the most time-consuming part of any computer because of their physically moving parts. Writing data is usually “painful” to the user.
Cache helps to speed up data-writing processes by virtually fooling the rest of the computer. A hard drive will take data into its cache and begin writing it. Instead of waiting to write all the data onto the platters, the HDD signals the computer that it did. The PC or Mac either continues sending more data, or it moves on to other tasks, believing that the process is complete. Either way, this allows the computer as a whole to continue to the next event.
There is a downside, though. While the hard drive is trying to make good on its promise to write the data, it can lose it. If the computer is powered off suddenly, all of the data stored in the cache will disappear. Cache, like RAM, is volatile storage.
Speeding Up Your Hard Drive
The cache isn’t going to equate to faster drive performance on single tasks directly. It’s not like it’s causing the drive to move faster. Having a disk buffer does, however, allow a hard drive to multitask much more efficiently, and chances are, that’s something that you’ll need.
It’s rare that a drive does just one thing or will only interact with one process at a time. Disk-based hard drives are still well-known storage devices in modern PCs. However, solid-state drives (SSDs) are gradually replacing those hard disk drives (HDDs). Even with a single task, multiple programs may need to access that storage at a time. You may be working with two or more files from your storage drive at once.
Servers are another space where having cache in hard drives is critical. Server hard drives are always going to be doing multiple things. Think of a database behind a website. Every time a user completes an action that the website has to store or log, the site accesses the info and writes it to the database. Every time someone even views that website, it reads from the database. It would be rare that the drives storing that database wouldn’t be performing multiple tasks simultaneously.
Cache In SSDs
SSDs aren’t as slow as physical hard drives, so do they need cache too? In short, they do. While cache in hard drives behaves like RAM, cache in solid-state drives serves as dynamic random-access memory (DRAM). It’s much faster and keeps pace with the SSDs.
Even though SSDs are much faster than their disk-based counterparts, cache still delivers benefits. Solid-state drives still use cache to regulate input/output and provide somewhat faster read and write access. Meanwhile, some SSDs don’t have built-in DRAM. It saves on power consumption but forces the drives to compensate in other ways.
Buying a Drive
So, cache obviously does matter. The cache isn’t as important as the primary drive specs, but you should still take it into account. If your drive is going to be multitasking or running continuously, like in a server or used for gaming platforms, look for larger cache sizes. You’re going to see the most benefit from it. Home users that are looking for a storage drive for occasional use don’t have to worry about it as much. For SSDs, the waters are a little murkier, but it’s still worth considering cache in your decision process. Other factors can easily overshadow it, though.