How to use MongoDB as a pure in-memory DB (Redis style) by Antoine Girbal.
From the post:
There has been a growing interest in using MongoDB as an in-memory database, meaning that the data is not stored on disk at all. This can be super useful for applications like:
- a write-heavy cache in front of a slower RDBMS system
- embedded systems
- PCI compliant systems where no data should be persisted
- unit testing where the database should be light and easily cleaned
That would be really neat indeed if it was possible: one could leverage the advanced querying / indexing capabilities of MongoDB without hitting the disk. As you probably know the disk IO (especially random) is the system bottleneck in 99% of cases, and if you are writing data you cannot avoid hitting the disk.
One sweet design choice of MongoDB is that it uses memory-mapped files to handle access to data files on disk. This means that MongoDB does not know the difference between RAM and disk, it just accesses bytes at offsets in giant arrays representing files and the OS takes care of the rest! It is this design decision that allows MongoDB to run in RAM with no modification.
Reports getting 20K writes per second on a single core.
I can imagine topic map scenarios where no data should be persisted.
You?