aergoio/litetree

branch and thread ?

Opened this issue · 3 comments

Is the multi branch work with multi thread or process ?

I mean for example branch master work on thread A, and test for thread B at same time without lock ?

Hi!

It supports many connections to the same database on a single thread (as you can see in the tests).

But many threads writing to the db at the same time, probably not.

With LMDB it is suggested that the writes are serialized and implemented on a single thread.

It does not mean that it is impossible to implement multi-threading support. Writes would need to be redirected to a dedicated worker thread. Or maybe using a mutex.

Many processes using the same db: not tested. Maybe it can work because LMDB uses a lock file.

If there is one write thread, and multi read thread with diff branch. will this work ?

Yep, it should work. Although not tested yet.

You can make a multi-threaded test based on the test04_concurrent_access function from test.py