Abstract
This paper introduces FlexSpace, a storage engine designed to enable efficient, in-place data insertions and removals within a file's address space. By utilizing a novel indexing structure called FlexTree, the system reduces the computational complexity of shifting data from $O(N)$ to $O(\log N)$. This architectural shift allows developers to build high-performance Key-Value (KV) stores, such as FlexDB, which maintain logically sorted data without the excessive write amplification typical of Log-Structured Merge-trees (LSM-trees).
The Rigidity of Traditional File Systems
Traditional file systems treat address spaces as rigid structures. Inserting a small piece of data into the middle of a sorted file typically forces a developer into one of two inefficient paths: rewriting the entire subsequent portion of the file (an $O(N)$ operation) or employing complex indirection layers like LSM-trees or B-trees. While indirection avoids immediate full-file rewrites, it introduces significant write amplification through background compactions and read amplification by requiring searches across multiple levels.
Modern file systems like Ext4 or XFS provide insert-range primitives, but these are often restricted by block-alignment requirements and suffer from metadata overhead when managing large numbers of extents. As shown in the performance comparison below, traditional rewrite and insert-range operations struggle to maintain throughput as the volume of data grows, whereas standard sequential writes (PWRITE) remain stable.
The FlexTree Architecture
The core innovation of FlexSpace is FlexTree, an augmented $B^+$-Tree specifically engineered for address space management. Unlike a standard $B^+$-Tree that stores absolute file offsets, FlexTree introduces two key mechanisms:
- Partial Offsets: Nodes store offsets relative to their position in the tree rather than absolute values.
- Shift Values: Every pointer to a child node includes a "shift value." When data is inserted, FlexTree only needs to update a few shift values along the search path rather than modifying every downstream entry.
This hierarchical approach transforms the linear cost of data shifting into a logarithmic one ($O(\log N)$), enabling byte-granularity flexibility in the address space without the metadata bottleneck.
FlexSpace and FlexDB Implementation
FlexSpace is implemented as a user-space library that manages log-structured space for write efficiency. It employs logical logging and Copy-on-Write (CoW) to ensure crash consistency without the redundant overhead of traditional journaling.
Building on this foundation, the authors developed FlexDB, a Key-Value store. Unlike RocksDB, which manages multiple levels of files, FlexDB maintains all KV pairs in a single, logically sorted linear address space. This simplicity allows FlexDB to achieve high performance with a significantly smaller codebase.
Evaluation and Key Results
The system was evaluated using microbenchmarks, YCSB workloads, and synthetic datasets modeled after Facebook production traces (ZippyDB, UDB, and SYS). Key findings include:
- Throughput: FlexDB achieved up to 3.3x higher write throughput and 16x higher read throughput compared to RocksDB and KVell.
- Write Efficiency: In random insertion tests, FlexSpace maintained a Write Amplification (WA) ratio near 1.0, significantly outperforming Ext4 and XFS, which reached ratios as high as 5.5 due to metadata journaling.
- Metadata Performance: FlexTree performed insertions orders of magnitude faster than standard $B^+$-Trees as the number of extents reached $10^6$.
- Scalability: The system demonstrated linear scalability for read operations across multiple client threads.
Conclusion and Future Work
FlexSpace demonstrates that on modern high-performance hardware like Intel Optane SSDs, logical sorting is more critical than physical co-location. By making "shifting" a first-class, efficient operation at the metadata level, the storage layer can alleviate the data organization burdens previously placed on the application layer.
Future work aims to move FlexSpace from user-space into the kernel to reduce dependency on underlying file systems and to address the current single-threaded committer bottleneck to further improve high-concurrency write performance.
Summary updated