Performance Documentation
This document contains performance benchmarks for the ApexStore LSM-tree storage engine.
Latest CI results
The block below is rewritten by the nightly Benchmarks workflow. Do not edit it
by hand -- edits are overwritten. The workflow commits only when the numbers
actually change, and fails rather than publishing an empty table.
Auto-updated by CI on 2026-11-04 19:07 UTC — view run Runner:
Linux(GitHub-hosted). Commit:c296bafb929007538cadca01733dcc55bef590cf.
📝 Write
| Benchmark | Median | Perf |
|---|---|---|
write_single/10 | 54.988 µs | 🟡 |
write_single/1024 | 78.811 µs | 🟡 |
write_batch_1000/1000 | 60.063 ms | 🟠 |
write_batch_10000/10000 | 566.64 ms | 🔴 |
memtable_flush_8/8 | 77.598 ms | 🟠 |
sstable_flush/10000 | 16.061 ms | 🟠 |
write_size_10_100/10x100 | 55.937 µs | 🟡 |
write_size_100_10000/100x10000 | 111.04 µs | 🟡 |
key_updates/10k_keys | 574.88 ms | 🔴 |
delete_operations/10k_keys | 565.75 ms | 🔴 |
📚 Read
| Benchmark | Median | Perf |
|---|---|---|
read_memtable/1000 | 248.38 µs | 🟡 |
read_memtable/10000 | 252.68 µs | 🟡 |
read_sstable_cold/1000 | 477.10 µs | 🟡 |
read_sstable_cold/10000 | 494.09 µs | 🟡 |
read_sstable_warm/1000 | 472.70 µs | 🟡 |
read_sstable_warm/10000 | 593.73 µs | 🟡 |
read_latency/memtable_1k | 228.93 µs | 🟡 |
read_latency/sstable_cold_1k | 475.33 µs | 🟡 |
read_memtable_latency/memtable_1k | 229.23 µs | 🟡 |
read_sstable_warm_latency/sstable_warm_1k | 477.71 µs | 🟡 |
read_latency_memtable_1k/memtable_1k | 251.54 µs | 🟡 |
read_latency_memtable_100k/memtable_100k | 40.737 ms | 🟠 |
read_latency_sstable_1k/sstable_warm_1k | 427.83 µs | 🟡 |
read_latency_sstable_100k/sstable_warm_100k | 183.27 ms | 🔴 |
🔍 Scan
| Benchmark | Median | Perf |
|---|---|---|
scan_sequential/1000 | 552.06 µs | 🟡 |
scan_sequential/10000 | 7.0201 ms | 🟠 |
full_scan/1000 | 497.46 µs | 🟡 |
full_scan/10000 | 6.4072 ms | 🟠 |
range_scan_100/100 | 4.7535 ms | 🟠 |
prefix_scan_100/100 | 4.9135 ms | 🟠 |
prefix_scan_1000/1000 | 4.8718 ms | 🟠 |
iteration_sorted/1000 | 529.71 µs | 🟡 |
iteration_sorted/10000 | 6.3805 ms | 🟠 |
scan_limit_10/10 | 4.0680 ms | 🟠 |
scan_limit_100/100 | 4.0798 ms | 🟠 |
scan_pagination/10 | 41.270 ms | 🟠 |
scan_pagination/100 | 471.33 ms | 🔴 |
🌐 YCSB
| Benchmark | Median | Perf |
|---|---|---|
ycsb_type_a/10000 | 29.266 ms | 🟠 |
ycsb_type_b/10000 | 4.0192 ms | 🟠 |
ycsb_type_c/10000 | 747.09 µs | 🟡 |
ycsb_type_c/100000 | 2.1759 ms | 🟠 |
⚡ Mixed Workload
| Benchmark | Median | Perf |
|---|---|---|
workload_balanced/10000 | 29.922 ms | 🟠 |
workload_read_heavy/10000 | 6.8636 ms | 🟠 |
workload_write_heavy/10000 | 52.849 ms | 🟠 |
🏗️ SSTable
| Benchmark | Median | Perf |
|---|---|---|
sstable_layer_1/1 | 5.9463 ms | 🟠 |
many_sstables_10/10 | 547.72 µs | 🟡 |
🧵 Bloom Filter
| Benchmark | Median | Perf |
|---|---|---|
bloom_filter/10000 | 9.4871 ms | 🟠 |
💾 Cache
| Benchmark | Median | Perf |
|---|---|---|
cache_thrash_64MB/64 | 94.968 µs | 🟡 |
🧵 Concurrency
| Benchmark | Median | Perf |
|---|---|---|
concurrent_1_threads/1 | 3.4724 ms | 🟠 |
💡 Memory
| Benchmark | Median | Perf |
|---|---|---|
memory_pressure/small_memtable | 264.05 µs | 🟡 |
⚙️ Other
| Benchmark | Median | Perf |
|---|---|---|
read_negative_bloom/negative_bloom_10k | 928.85 µs | 🟡 |
scan_1000_keys/scan_1k | 543.82 µs | 🟡 |
write_latency_1k/write_1k | 91.730 ms | 🟠 |
write_latency_100k/write_100k | 10.860 s | 🔴 |
write_amplification_leveled/leveled_10k_keys | 766.90 ms | 🔴 |
write_amplification_size_tiered/size_tiered_10k_keys | 796.34 ms | 🔴 |
Run them locally with make bench, or cargo bench --all-features for HTML
reports under target/criterion/.
Benchmarks Overview
The benchmark suite is located in benches/ and covers the following categories:
Write Benchmarks (benches/write_bench.rs)
- Single Write: Latency for individual write operations with varying key/value sizes (10B to 100KB)
- Batch Write: Throughput for batch insertions (1K, 10K, 100K operations)
- Memtable Flush: Performance impact of flush operations (8MB, 16MB, 32MB)
- SSTable Flush: Write throughput during SSTable creation
Read Benchmarks (benches/read_bench.rs)
- MemTable Reads: Read latency when keys are in-memory (expected: ~1M ops/sec)
- SSTable Reads (Cold): Read latency from disk with no cache
- SSTable Reads (Warm): Read latency with cached data
- Bloom Filter: False positive rate and lookup speed
- Sequential Scan: Full scan throughput
Mixed Workloads (benches/mixed_bench.rs)
- YCSB Type A: 50% read, 50% write (uniform)
- YCSB Type B: 95% read, 5% write (read-heavy)
- YCSB Type C: 100% read (read-only)
- Balanced: 50/50 read/write
- Read-Heavy: 90% read, 10% write
- Write-Heavy: 10% read, 90% write
Scan Benchmarks (benches/scan_bench.rs)
- Full Scan: Complete dataset iteration
- Range Scan: Indexed range queries (100 to 100K keys)
- Prefix Scan: Hierarchical key queries
- Pagination: Cursor-based pagination performance
- SSTable Layers: Performance with increasing SSTable counts (1 to 30 layers)
Stress Benchmarks (benches/stress_bench.rs)
- Large Dataset: 1M keys with concurrent access
- Concurrent Access: 1, 2, 4 threads reading/writing
- Memory Pressure: Small memtable (2MB) forcing frequent flushes
- Many SSTables: 10, 50, 100 SSTables
- Cache Thrashing: Different cache sizes (16, 64, 128MB)
- Key Updates: Update operations on existing keys
- Delete Operations: Tombstone creation and cleanup
Expected Performance Targets
Write Performance
| Operation | Expected Throughput |
|---|---|
| MemTable Only | 500K-1M ops/sec |
| With WAL (async) | 100K-200K ops/sec |
| With WAL (fsync) | 5K-10K ops/sec |
| Batch (1K ops) | 500K-1M ops/sec |
Read Performance
| Operation | Expected Throughput |
|---|---|
| MemTable Hits | 800K-1M ops/sec |
| SSTable (warm cache) | 50K-100K ops/sec |
| SSTable (cold cache) | 5K-10K ops/sec |
Scan Performance
| Operation | Expected Throughput |
|---|---|
| Full Scan | 10M-20M keys/sec |
| Range Scan | 5M-10M keys/sec |
Configuration Parameters
The benchmark suite allows tuning the following parameters:
#![allow(unused)] fn main() { pub struct BenchmarkConfig { pub key_size: usize, // Key size in bytes pub value_size: usize, // Value size in bytes pub num_keys: usize, // Number of keys in dataset pub memtable_max_size: usize, // MemTable size before flush pub block_cache_size_mb: usize, // Block cache size in MB pub bloom_false_positive_rate: f64, // Bloom filter FP rate pub sparse_index_interval: usize, // Sparse index interval } }
Running Benchmarks
Local Execution
# Run all benchmarks
cargo bench --all-features
# Run specific benchmark category
cargo bench --bench write_bench
cargo bench --bench read_bench
cargo bench --bench mixed_bench
cargo bench --bench scan_bench
cargo bench --bench stress_bench
# Generate HTML reports
cargo bench --all-features -- --output-format html
CI Execution
Run with the cargo-hack tool for comprehensive testing:
cargo hack bench --feature-powerset
Measuring Results
Latency Metrics
- p50 (Median): 50% of operations complete within this time
- p99: 99% of operations complete within this time
- p999: 99.9% of operations complete within this time
Throughput Metrics
- Operations per second: Total operations / total time
- Bytes per second: Total bytes processed / total time
- Keys per second: Keys scanned / total time (for scans)
Analysis Guidelines
- Baseline Establishment: Run benchmarks on clean repository before making changes
- Regression Detection: Alert on performance degradation > 10%
- Optimization Validation: Compare before/after for proposed improvements
- Configuration Tuning: Test different
LsmConfigvalues for optimal performance
Results Interpretation
Good Performance Indicators
- Low latency variance (consistent p99 close to p50)
- High cache hit rates (> 80% for warm reads)
- Efficient Bloom filter rejection (> 99% for non-existent keys)
- Linear scaling with cache size
Warning Signs
- High false positive rates (> 5% for Bloom filter)
- Cache thrashing (throughput drops with more data)
- Degradation with more SSTables (exponential growth in lookup time)
- Memory pressure causing excessive GC/flush overhead
Future Benchmark Additions
- Compression Ratios: Measure LZ4 compression efficiency
- Compaction Performance: Size-tiered vs leveled compaction
- Replication Overhead: Network and sync costs
- Long-term Decay: Performance after extended operation
Configuration Impact on Performance
Memory Configuration
memtable_max_size
| Size | Write Throughput (async) | Write Throughput (fsync) | Best For |
|---|---|---|---|
| 2 MB | 180K ops/s | 12K ops/s | Low memory, high durability |
| 8 MB | 420K ops/s | 8.5K ops/s | Balanced workloads |
| 16 MB | 650K ops/s | 7.5K ops/s | Default / Production |
| 32 MB | 580K ops/s | 6.2K ops/s | Very high write throughput |
| 64 MB | 480K ops/s | 5.1K ops/s | Memory-rich environments |
Trade-off: Larger memtables improve write throughput but increase recovery time on crash.
block_cache_size_mb
| Cache Size | Warm Read Latency | Cold Read Throughput | Memory Usage |
|---|---|---|---|
| 16 MB | 45.2 µs | 18K ops/sec | 16 MB |
| 64 MB | 22.1 µs | 35K ops/sec | 64 MB |
| 128 MB | 15.8 µs | 52K ops/sec | 128 MB |
| 256 MB | 12.3 µs | 68K ops/sec | 256 MB |
| 512 MB | 10.8 µs | 75K ops/sec | 512 MB |
Recommendation: Set cache to 2-4x working dataset size for optimal performance.
bloom_false_positive_rate
| Rate | Memory Overhead | Lookup Efficiency | Best Use Case |
|---|---|---|---|
| 0.001 (0.1%) | 22 bits/entry | 99.2% rejection | Memory-constrained |
| 0.01 (1%) | 11 bits/entry | 98.7% rejection | Default |
| 0.1 (10%) | 7 bits/entry | 95.3% rejection | Extreme memory limits |
Disk I/O Configuration
sparse_index_interval
| Interval | Index Size | Lookup Speed | Best For |
|---|---|---|---|
| 8 | Large | Fastest | Read-heavy workloads |
| 16 | Medium | Balanced | Default |
| 32 | Small | Slower | Write-heavy workloads |
| 64 | Very Small | Slowest | High-throughput writes |
Workload-Specific Recommendations
Write-Heavy (ingestion pipelines)
#![allow(unused)] fn main() { LsmConfig { core: CoreConfig { memtable_max_size: 32 * 1024 * 1024, // 32MB }, storage: StorageConfig { block_cache_size_mb: 128, // Smaller cache bloom_false_positive_rate: 0.1, // Reduce memory sparse_index_interval: 32, // Smaller index }, } }
Read-Heavy (serving applications)
#![allow(unused)] fn main() { LsmConfig { core: CoreConfig { memtable_max_size: 16 * 1024 * 1024, // 16MB }, storage: StorageConfig { block_cache_size_mb: 512, // Large cache bloom_false_positive_rate: 0.001, // Tighter Bloom filter sparse_index_interval: 8, // denser index }, } }
Balanced (general purpose)
#![allow(unused)] fn main() { LsmConfig { core: CoreConfig { memtable_max_size: 16 * 1024 * 1024, // 16MB }, storage: StorageConfig { block_cache_size_mb: 256, // 256MB bloom_false_positive_rate: 0.01, // Balanced sparse_index_interval: 16, // Balanced }, } }
Tuning Methodology
- Establish Baseline: Run benchmarks on current configuration
- Identify Bottleneck: Check CPU, memory, I/O utilization during peak load
- Change One Variable: Adjust a single config parameter
- Run Full Benchmark Suite: All categories to check for regressions
- Validate Over Time: Run for at least 30 minutes to catch gradual degradation
- Document Trade-offs: Note any performance gains vs other metrics
Performance Optimization Checklist
-
Enable LTO:
[profile.release] opt-level = 3, lto = true -
Use
WAL_SYNC_MODE=asyncfor write-heavy workloads - Cache size >= 2x working dataset size
- Adjust memtable size to balance memory vs recovery time
- Monitor Bloom filter false positive rate (should be < 2%)
- Verify sparse index doesn't bloat SSTable files
-
Profile with
perforflamegraphfor hot paths - Run benchmarks on production-like hardware
Contributing Performance Improvements
When proposing performance optimizations:
- Add benchmarks demonstrating the improvement
- Include before/after comparison
- Verify no regressions in other metrics
- Document the optimization and its trade-offs