In LMDB, can multiple threads access the same database at the same time?

I am considering using LMDB in a web application, which, of course, will be multithreaded.

The Symas docs for mdb_dbi_open say: "This function should not be called from multiple concurrent transactions. A transaction using this function must complete (either commit, or abort) before any other transaction can use this function."

This, apparently, implies that several threads cannot simultaneously access (write) to this database.

But the review says: "The scriptures are completely serialized, only one write transaction can be active at a time, which ensures that writers can never slow down." This seems to mean that I don't need to worry about that.

My question is: do I need to serialize my write transactions or will LMDB take care of this for me?

+5
source share

Source: https://habr.com/ru/post/1204995/


All Articles