← Back
Home › Systems › Databases and storage engines

btree-engine

embedded B+tree storage engine

LMDB, WiredTiger

SystemTechniques · 4Primitives · 19 btree-engine B link treestorage · medium: Lehman-Yao B-tree with right-links and high keys for latch-free reads and concurrent splitsBuffer poolstorage · medium: The database's own page cache (frames, page table, pin counts, dirty bits, replacement) so it, not the OS, controls eviction, write order and I/O.›Copy on write b treestorage · medium: Append-only/shadow-paging B+tree: copy the root-to-leaf path on write, atomic root swap (LMDB style)MVCCstorage · medium: Keep timestamped versions of each row so readers see a consistent snapshot without blocking writers; the default concurrency control in modern databases.›B+ treestorage · low: Balanced high-fanout search tree with all values in linked leaves; the default on-disk index for point lookups and range scans.›fsync, O_DSYNC and O_DIRECThardware-os · low: What fsync, fdatasync, O_DSYNC, O_DIRECT and F_FULLFSYNC really guarantee on Linux and macOS, and the exact call sequences for crash-safe files.›LRU and CLOCKsystems · low: LRU evicts the least recently used entry via hash map plus linked list; CLOCK approximates it with a reference bit, so hits take no lock.›Free space managementstorage · low: Free-space bitmaps, extent B-trees and space maps; allocation policies and fragmentationPrefix compressioncompression · low: Front coding / shared-prefix truncation of sorted keys in blocks and index pagesHazard pointersconcurrency · low: Readers publish the exact pointers they are about to dereference; a reclaimer frees retired objects that no published hazard names, giving bounded garbage.›Advisory file lockinghardware-os · low: Fcntl/flock byte-range and whole-file locks for multi-process access to one fileCRC32C checksumshardware-os · low: The Castagnoli CRC-32 with dedicated instructions on x86 (SSE4.2) and ARMv8. It is the standard fast integrity check for storage blocks, logs and network frames.›mmap and the page cachehardware-os · low: How read() and mmap reach file data through the kernel page cache, what readahead and madvise do, and why databases use their own buffer pool instead.›Group commitstorage · low: Let concurrent committers share one log write and fsync; throughput grows with concurrency while each commit still waits at most about two fsyncs.›Slotted pagesstorage · low: Fixed-size page layout for variable-length records, with a slot array growing from the front and data from the back; stable record IDs despite compaction.›Write-ahead logstorage · low: Append each change to a checksummed sequential log and fsync it before touching data pages; the basis of crash durability in nearly every database.›Epoch-based reclamationconcurrency · low: Threads announce a global epoch while touching shared lock-free data; garbage retired in epoch e is freed once the epoch reaches e + 2.›Seqlockconcurrency · low: Readers copy shared data optimistically and retry if a sequence counter changed; zero reader writes, so reads scale perfectly with a single fast writer.›S3-FIFOsystems · low: Three FIFO queues (small, main, ghost) that evict one-hit wonders quickly and keep reused objects; low miss ratios with no list moves on hits.›Futex-based mutexconcurrency · low: A mutex that is one atomic word in user space and enters the kernel (futex wait/wake) only under contention; how std and glibc locks work.›+ 3 more primitives

Similar systems

Share the most building blocks with this one.