Lightning Memory-Mapped Database: Difference between revisions

Content deleted Content added
m move refs on concurrency section. probably more needed at some point.
m doh missing bracket
Line 44:
 
=== Concurrency ===
LMDB employs [[multiversion concurrency control]] (MVCC) and allows multiple threads within multiple processes to coordinate simultaneous access to a database. Readers scale linearly by design<ref>[http://www.lmdb.tech/bench/inmem/scaling.html scaling benchmarks for LMDB]</ref><ref>[http://www.lmdb.tech/bench/inmem/scale2/ in-memory benchmark scaling for LMDB]</ref>
. While write transactions are globally serialized via a [[mutex]], read-only transactions operate in parallel, including in the presence of a write transaction, and are entirely [[wait free]] except for the first read-only transaction on a thread. Each thread reading from a database gains ownership of an element in a shared memory array, which it may update to indicate when it is within a transaction. Writers scan the array to determine the oldest database version the transaction must preserve, without requiring direct synchronization with active readers.