RAM-only Databases

DevChannel has a discussion on databases which reside completely in memory, made possible by the falling costs of memory.

Larger RAM allotments make it possible to store some databases entirely in RAM, which can make everything faster and easier. It then doesn’t matter if the disks are 5400 or 7200 RPM. This quest is not out of the question even for larger databases, although it is clearly still an impossibility for some of the truly huge collections being contemplated.

The most interesting question is what this does to the architecture of the database software itself. A large part of the complexity in a database’s design involves providing fast persistence by carefully writing the information to a hard disk. The best databases have an elaborate caching structure for keeping the most requested data in RAM while writing all changes through to the hard disk.

Much of this elaborate caching forces database programmers to pay strict attention to the disk and double-check to ensure that the data is correct. The database first writes the data, then double-checks that it’s there. If the write was successful, the database commits the new information, otherwise it rolls back. This care, often called the ACID principles, state that a database’s operations must be Atomic, Consistent, Isolated, and Durable.

If all of the information is kept in RAM, the game changes. There’s no need to make sure that the RAM and the disk are consistent because there is no disk. The database designer’s job becomes easier and the database becomes faster still.

There is also an interview with the MySQL creator Michael “Monty” Widenius on the same topic. Says Monty: “The key thing here is persistent RAM, which would enable you to turn off the computer at any time and restart it without losing any data. This would open up totally new ways to develop faster and safer databases. With current databases, one of the hardest things (which requires a lot of resources and is one of the major bottlenecks in most databases) is handling transactions so that you don’t lose data when the computer goes down. With persistent RAM this problem is much easier to solve.”

Published by

Rajesh Jain

An Entrepreneur based in Mumbai, India.