Wednesday, March 11, 2009

Using ram and batteries to get green and faster Hard Drives

Reducing power usage on hard disks by using ram and batteries

Most computers use hard disks. When it comes to price per Gigabyte that still is the most economical solution. They also use quite a bit of power. Anyone that has ever assembled a low power machine and started adding the watts knows that in particular 3.5 inch HD's use quite a bit. 2.5 inch hard disks (used in laptops) use substantially less, but they are also much more expensive and cannot hold the same amount of data.

The most important reason that these disks use this much power is that the data is placed on so called platters. These platters move around their axis at (commonly) 7200 rpm. So the platters make 7200 rounds each minute.
The disk keep the moving, even if the disk is not accessed. This is partly for speed reasons, spinning up takes time. So if your computer needs to read or write a file, it needs to wait until the disks are spinning. But also this is for durability. Hard disks suffer more wear from spinning up than rotating the platters continuously. Laptop hd's are designed to spin down more often. Therefore they can handle it that power management turns the disk off more often to conserve energy. But that does make them slower as well.

RAM memory is much faster than hard disks and uses a lot less energy. But using RAM is not very smart as RAM is not just much more expensive, it is also volatile. As soon as the power is of, all the data is gone. But RAM is getting cheaper.

If you have a large hard disk, you under most circumstances always use roughly the same set of files. The rest of the files are basically just stored there (hard disks provide storage).

So for a relatively small set of files we keep the disks spinning. We can't use ram for this since RAM is not storage. My idea is to combine disks and RAM to make sure that the disks are spinned down most of the time.

Let's add to a regular HD (say 1 TB) 8 gb of RAM. Now I realise that' s not cheap, but we don't need the fastest and most expensive RAM. Any RAM is already faster then a HD. And now also add a battery.

Now also add to the controller in the disk logic that does the following:
- it keeps every file read in RAM until that RAM is full, when files in RAM get flushed based on how much is needed and the priority a file has. The priority is really a combination of when files are last accessed and how often they are usually accessed. (this sounds like cache, but there is more)
- every file that is written is also written to RAM first. The files don get written to disk yet, the write to the disks is delayed.
- the files that are in delayed write are written to disks when:
- the RAM is getting full (i.e. when the delayed writes > 3.5 Gb)
- on set times during the day (i.e. twice a day)
- when the computer is turned down.
That's where the battery is for. When the computer is turned down, or for any other reason the HD no longer gets power, it flushes the delayed writes to disk. The battery provides the power to complete this task when the power to the HD is cut. Also it keeps the files it has read in memory, for as long as it has power.
That means that if you reboot and there was still enough power in the battery to keep the RAM up, the files it needs to reboot are likely in the RAM part of this disk.. As result, considering that RAM is much faster than disks, the whole boot part gets to be much faster.

The result: in most use cases your computer get's a much faster hard disk that uses a lot less power. The disks are spinned up only when accessing rarely used or overly large files and a few times a day for the scheduled writes and writes of larges files.
As a result you get a hybrid between RAM and storage. It should be much faster and also use a lot less energy. And yet you still get the terabyte of storage.
I think that even with just 4 GB you can achieve this. Of course 8 GB would be more effective.

No comments:

Post a Comment