Are the contents in a LMDB always stored BOTH in disk AND memory?

989 views Asked by At

I'm wanting to use the rust implementation of LMDB but I can't seem to find whether it would always maintain a copy of whats in memory also in the disk and viceversa. My reasoning would be that the DB will have some cache and any overflows would be written to disk but since I can't find it in the documentation I'm not sure.

The other case would be that LMDB maps its contents on disk to memory and that would work for small quantities but not for what I have in mind.

Does anyone have an idea on how LMDB works on this regard?

1

There are 1 answers

1
Asad Awadia On

Does anyone have an idea on how LMDB works on this regard?

If you are worried about not being able to operate on a dataset that does not fit in memory, you are ok - LMDB does handle that. Your dataset is not limited to the size of ram.

LMDB is memory-mapped which is a technique that allows developers to read/write data on disk 'like' it is in memory - the OS does all the heavy lifting required

LMDB always stored BOTH in disk AND memory?

The entire dataset is on disk. Some parts of it are in memory. When the parts that are not in memory are needed - the OS fetches it from disk and gives it to the application by putting it in the process' memory