3

I am looking for a database that is -

  • Relational (Not NoSQL).
  • Has an in-memory store.
  • Has disk-based backing storage.

I want to set up a system where entire contents of the disk are replicated in memory. So writes are made to both the in-memory store and disk, but reads are done only against memory.

Most of the databases I have seen such as H2 or HSQLDB offer in memory grid or disk based tables. I am looking for an in-memory grid WITH disk based backing storage.

Is there such a database system available or is it possible to configure MySQL (or some other) database to work in such a manner?

1
  • Looks like premature optimization again. Why do you think you need an in-memory database?
    – mustaccio
    Commented Mar 20, 2014 at 18:03

5 Answers 5

5

H2 and HSQLDB will cache the tables in memory, even if you use "persistent" tables.

In HSQLDB you can control the amount of memory that is used to hold table data, using the SET FILES CACHE SIZE statement. I think H2 has something similar.

So if you create cached tables and make the data cache large enough you will wind up with tables stored on disk but held in memory.

1
  • What caching strategy is used? Commented Jul 24, 2012 at 10:34
4

Well, most relational databases will meet those needs as written if your db is small enough to fit in memory. Most have buffer pools for frequently accessed data. This is a common strategy. I know PostgreSQL will do this generally, although it will flush pages from memory to disk and write to the WAL. So if your db fits quite comfortably in memory it all gets managed that way. PostgreSQL uses the 2Q caching algorithm with the OS filesystem buffer as a third tier (writes to the transaction log are flushed on each commit though ensuring durability, but the tables are not).

The big issue though is that this does impose some overhead. You get the standard performance of a good RDBMS. Also managing things in disk format has some penalties. So you won't get something like VoltDB with disk-backed storage. Such a thing doesn't exist because of the translation issues between main memory format and disk-based format.

3

Depending on what your requirements are about how it meets your criteria, an Oracle database would apply. If your buffer cache memory area is as large as the database itself then as the data is accessed it would be copied into memory eventually causing most reads to be done in memory. Writes would still go to disk.

You could also consider a RamSan type device that allows memory to behave as a disk. They use disks for their persistent store, which would give you some of the same benefits and allow you to use any database you like.

1

Yes. ALTIBASE HDB - HybridDB DRAM DB and Disk DM SQL standards compliant, supports all common interfaces, HA, ACID in 1 single unified engine = 1 DB for both.

For Caching difference please see: http://altibase.com/solutions/

For HybridDB product overview see: http://altibase.com/products/

1

H2 Database Engine

H2 is relational and is an in-memory database in nature. Also it has disc storage mode which gives you the persistency and manages fail overs. But the best feature of H2 is clustering two H2 instances in "in-memory" mode, Which provides you a more stable database. The only worry about H2 is the power-outage or JVM crashes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.