What is the In-Memory Database?
In-Memory Database (IMDB) is also known as the Main Memory Database (MMDB) or Memory Resistance Database. It is a Database Management System that primarily accesses the main memory or RAM for the data storage. In-memory Database is faster and more accurate than the disk storage.
Constraints of In-Memory Database
In case of a system crash or lack of power supply, we cannot save the data in the In-Memory Database. It uses Volatile RAM which needs a power supply to maintain the stored data. Therefore, the In-Memory Database would not be able to offer the much-required Durability vis-à-vis the old database management system.
However, is it possible to ensure the durability of data using any tool or plug-in in the In-Memory Database? Yes, we can!
Our Solution
We can store our e-commerce application data in the main memory and also persist each operation in the transaction log using the Transactional Logging mechanism. With this method, the In-memory database would acquire Persistence. Oracle Commerce utilizes Oracle Coherence for in-memory data-grid, thus providing high availability and scalability.
The diagram above showcases that In-Memory Database with persistence is quite fast. It does not allow the queries to slow down as they hit the main memory.
On the other hand, we wonder what happens when the Application or system needs an update. Updates to the application uses the main memory, as well as the disk for maintaining the Transaction Log. Now, we have established that the disk is slower! It is now logical to assume that the entire operation would be slow as we use the disk for updates.
We are using each update as a Transaction. Therefore, in the Transactional Logging mechanism, we recommend you to use the append-only way for each Transaction (update).
Please refer to the given diagram –
What different is the In-Memory Database from the regular Disk-based Database System?
The Disk-based Database needs to read data from the disk on each query. On the other hand, the In-Memory Database does not use the disk until your Oracle Commerce system needs recovery during the system start-up; Thereby, making it faster than the disk-based database.
Oracle commerce utilizes Oracle Coherence which can be seamlessly expanded by adding more memory and processing power.
The diagram above clarifies-
The In-Memory Database doesn’t use the Disk until there is any change-operation to perform.
In the case of a data-change operation, the In-Memory Database uses the Disk in the fastest manner and with persistence.
To Conclude
We would like to recommend another method to provide Durability to the In-Memory Database. You can choose to Snapshot the database! The Snapshot Transaction logs are compact and are quite capable of recovering the database. It is important to compress the logs as the bulkiness of the Transaction logs would make the recovery of the database a time-consuming task.
However, the Snapshot alone cannot provide complete durability. It is, therefore, important to supplement it with a Transactional logging mechanism.