Performance Fundamentals
Write Amplification
Amount of data written to storage vs. data written by application. Lower is better.
Read Amplification
Number of disk reads to retrieve data. Lower is better.
Space Amplification
Ratio of database size to actual data size. Lower is better.
Latency
Time to complete operations. Lower is better.
These metrics are often in tension. Optimizing one may degrade others. Tune based on your workload priorities.
Write Performance
Increase Write Buffer Size
Larger write buffers reduce compaction frequency:Optimize Level Compaction
Parallelism
Disable Write-Ahead Log (Careful!)
Read Performance
Block Cache
Increase block cache for better read performance:Bloom Filters
Bloom filters reduce unnecessary disk reads:Optimize Block Size
Prefix Bloom Filters
For workloads with prefix queries:Compression
Per-Level Compression
Compression Options
Memory Management
Write Buffer Manager
Limit total memtable memory across DB:Memory Monitoring
Compaction Tuning
Universal Compaction
For write-heavy workloads with less space:Compaction Priority
Rate Limiting
Workload-Specific Tuning
Write-Heavy Workload
Read-Heavy Workload
Point Lookup Optimized
Range Scan Optimized
Benchmarking
Using db_bench
Key Metrics to Monitor
- Write Metrics
- Read Metrics
- Resource Metrics
- Write throughput (ops/sec)
- Write latency (p50, p99)
- Stall time
- Compaction statistics
Statistics and Monitoring
Enable Statistics
Periodic Statistics Dump
Best Practices
1
Profile your workload
Understand your read/write patterns, data sizes, and access patterns before tuning.
2
Start with defaults
Use
IncreaseParallelism() and OptimizeLevelStyleCompaction() as a baseline.3
Tune incrementally
Change one parameter at a time and measure the impact.
4
Monitor continuously
Track metrics over time to detect performance degradation.
5
Test with production data
Synthetic benchmarks may not reflect real-world performance.
Common Pitfalls
Next Steps
Configuration
Review configuration options
Basic Operations
Master fundamental operations