3 ms·
Pls remember this database has no write ahead log and therefore is not too fast for write-intensive applications. But i really like it and regret I learned abou
by lafar6502 12y ago
Pls remember this database has no write ahead log and therefore is not too fast for write-intensive applications. But i really like it and regret I learned about it only recently.
PS and read the benchmark description carefully - some of the benchmarks are performed in memory, without actual disk i/o.
- _wmd 12y agoThis is only part of the story - LMDB lacks a WAL because it uses shadow paging, which is a complementary technique with totally different characteristics more suited to read-optimized loads. Similarly "not too fast for write-intensive apps" is only half the story - LMDB write transactions have a fixed cost related to the tree depth, so while many tiny updates may incur a noticeable fixed penalty in some cases, that cost becomes less noticeable e.g. with larger transactions performing reasonably localized updates (say, to partially sequential key ranges). Also note even for huge databases, the write overhead of shadow paging is usually somewhere south of 64kb per transaction. To reiterate, the fixed cost is essentially per-transaction rather than per-update.
- hyc_symas 12y agoFor some write-intensive applications it is faster than everything else. E.g. http://symas.com/mdb/hyperdex/ http://symas.com/mdb/hyperdex/ Depends a lot on your key and value sizes - the larger the values, the faster LMDB is vs any other solution, due to the zero-copy behavior.
- lafar6502 12y ago_wmd, hyc_symas I understand the principles of LMDB operation, the worst case scenario is lots of random writes that hit random pages in the db file. In such case the I/O will be heavy and random also, which leads to bad performance of disk operations (not so bad with SSD ,though). But you're right, if you avoid the worst case LMDB shines.
- hyc_symas 12y agoI'm pretty sure the worst case is purely size-dependent. The write pattern in the HyperDex benchmark is pure random but it still obliterates HyperLevelDB (and don't even think of vanilla LevelDB there). Keep in mind that LMDB uses free pages in sorted order, so even for a random write workload, pages are allocated in ascending order, which generally translates to unidirectional seeks on an HDD. This is why even for a purely random write load, LMDB is still faster than all of the traditional update-in-place B-trees out there - they really have to do random seeks, LMDB doesn't. (And you pay the highest in seek time when the drive head has to reverse direction.) That's why LMDB write performance remains uniform under load, while all LSMs suffer from GC/compaction pauses. But ultimately, storage is moving to solid state, and seek time will be irrelevant.