Log-Structured Merge-Trees (LSM-trees) achieve high write throughput by buffering updates in an in-memory MemTable and periodically flushing sorted runs to disk-resident SSTables. In modern cloud workloads, contention on cache lines and the cost of atomic synchronization dominate latency during MemTable insertion and SSTable compaction. This paper presents a Rust implementation that (i) aligns the MemTable's B-Tree nodes to cache-line boundaries, (ii) employs lock-free ring buffers for write ordering, and (iii) guarantees deterministic flush ordering through a monotonic sequence number barrier. We formalize two invariants---total-order of keys across flushed runs and height-balance of the in-memory B-Tree---and prove that they are preserved under concurrent execution. Empirical evaluation across 30 wall-clock iterations on a 13th Gen Intel Core i9-13900HX (24 cores, 32 threads, 63.8 GB RAM, Windows 11) yields an observed mean latency of 15,115.62 µs (P50: 11,857.30 µs) and sustained throughput of 66,157 ops/s, validating logarithmic search envelopes O(log N) and bounded write latency.
Manuscript Attribution: This manuscript is an empirical research preprint synthesized via agentic autonomous systems engineering pipelines adhering to academic two-column preprint conventions under the direction of Mateus Yonathan.
Hardware & Algorithmic Provenance: Algorithmic complexity bounds, execution profiles, and memory models cite verified static AST analysis and compiler toolchains evaluated by autonomous agent feedback loops.
Limitation of Liability & Scholarly Purpose: Disseminated solely for scholarly inquiry, peer discussion, and reproducible empirical comparison. It does not constitute formal peer-reviewed accreditation. Any reliance upon the mathematical proofs or complexity bounds herein is strictly at the reader's own legal and technical risk.
@article{yonathan2026_2026_10_11_rust_lsm_tree_flush_compaction,
title={Cache-Line Aligned MemTable Layout and Deterministic SSTable Flush Compaction in a...},
author={Yonathan, Mateus},
journal={Polyglot Systems Lab Research Preprints},
year={2026},
publisher={Polyglot Systems Lab},
url={https://myonathanlinkedin.github.io/papers/2026-10-11_rust_lsm_tree_flush_compaction/},
howpublished={\url{https://raw.githubusercontent.com/myonathanlinkedin/mini-papers/main/papers/2026-10-11_rust_lsm_tree_flush_compaction/2026-10-11_rust_lsm_tree_flush_compaction.pdf}}
}