mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-19 03:04:27 -05:00
perf(rocksdb): increase write buffer size to 128 MB (#21696)
This commit is contained in:
@@ -113,6 +113,13 @@ const DEFAULT_MAX_BACKGROUND_JOBS: i32 = 6;
|
||||
/// Default bytes per sync for `RocksDB` WAL writes (1 MB).
|
||||
const DEFAULT_BYTES_PER_SYNC: u64 = 1_048_576;
|
||||
|
||||
/// Default write buffer size for `RocksDB` memtables (128 MB).
|
||||
///
|
||||
/// Larger memtables reduce flush frequency during burst writes, providing more consistent
|
||||
/// tail latency. Benchmarks showed 128 MB reduces p99 latency variance by ~80% compared
|
||||
/// to 64 MB default, with negligible impact on mean throughput.
|
||||
const DEFAULT_WRITE_BUFFER_SIZE: usize = 128 << 20;
|
||||
|
||||
/// Default buffer capacity for compression in batches.
|
||||
/// 4 KiB matches common block/page sizes and comfortably holds typical history values,
|
||||
/// reducing the first few reallocations without over-allocating.
|
||||
@@ -221,6 +228,7 @@ impl RocksDBBuilder {
|
||||
cf_options.set_bottommost_compression_type(DBCompressionType::Zstd);
|
||||
// Only use Zstd compression, disable dictionary training
|
||||
cf_options.set_bottommost_zstd_max_train_bytes(0, true);
|
||||
cf_options.set_write_buffer_size(DEFAULT_WRITE_BUFFER_SIZE);
|
||||
|
||||
cf_options
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user