K/V存儲數據庫:Lightning MDB
LMDB是一個超快速,超緊湊的鍵 - 值存儲數據庫由Symas為OpenLDAP項目開發。它使用內存映射文件,所以它擁有一個純內存數據庫的讀取性能,同時還提供標準的基于磁盤的數據庫持久性,并且只限于虛擬地址空間的大小(但不限于物理RAM的大小)。
LMDB是一個微小的數據庫,但有一些強大的功能:
- 有序Map接口 (鍵總是排序,支持范圍查詢)
- 完整的事務支持,支持完整的 ACID semantics with MVCC.
- Reader/writer transactions: readers don't block writers and writers don't block readers. Writers are fully serialized, so writes are always deadlock-free.
- Read transactions are extremely cheap, and can be performed using no mallocs or any other blocking calls.
- Supports multi-thread and multi-process concurrency, environments may be opened by multiple processes on the same host.
- Multiple sub-databases may be created with transactions covering all sub-databases.
- Memory-mapped, allowing for zero-copy lookup and iteration.
- Maintenance-free, no external process or background cleanup/compaction required.
- No application-level caching. LMDB fully exploits the operating system's buffer cache.
- 32KB of object code and 6KLOC of C.
- Licensed under the OpenLDAP Public License </ul>
這是一個只讀優化設計和執行讀取比其他數據庫引擎快好幾倍,幾個數量級,在很多情況下更快。這不是一個寫優化設計;注重隨機寫入工作負載的其他數據庫的設計可能更適合。
特性比較
一些流行的嵌入式鍵/值存儲比較LMDB | BDB | LevelDB | Kyoto TreeDB | ||
ACID Transactions | x | x | |||
Nested Transactions | x | x | |||
Multiple Namespaces | x | x | |||
Sorted Keys | x | x | x | x | |
Sorted Duplicate Keys | x | x | |||
Multi-thread concurrency | x | x | x | x | |
Multi-process concurrency | x | x | |||
No cache tuning: zero-config | x | ||||
Instantaneous crash recovery | x | ||||
Zero-copy reads | x | ||||
Zero-copy writes | x | ||||
Atomic hot backup | x |
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!