pub struct RocksDbTuning {
pub write_buffer_bytes: usize,
pub max_write_buffer_number: i32,
pub block_cache_bytes: usize,
pub block_size_bytes: usize,
pub iterator_readahead_bytes: usize,
pub disable_auto_compactions: bool,
pub disable_wal: bool,
pub sync_writes: bool,
pub scan_async_io: bool,
pub pin_index_in_cache: bool,
pub bloom_filter_bits_per_key: Option<u8>,
}Expand description
RocksDB open knobs shared by hexastore partitions and the disk registry.
Fields§
§write_buffer_bytes: usizeMemTable write-buffer size (rocksdb_options_set_write_buffer_size).
max_write_buffer_number: i32Number of MemTables (rocksdb_options_set_max_write_buffer_number).
block_cache_bytes: usizeBlock cache size (rocksdb_cache_create_lru).
block_size_bytes: usizeSST data-block size (rocksdb_block_based_options_set_block_size).
Affects SSTs written after open (flush/compaction output); existing files keep their original block size until rewritten.
iterator_readahead_bytes: usizeFixed per-iterator readahead in bytes
(rocksdb_readoptions_set_readahead_size); 0 keeps the engine
default, whose implicit auto-readahead engages only for iterators with
an iterate upper bound or prefix_same_as_start (hexastore scans) and
never for the registry’s unbounded walk — which is why the registry
tuning sets an explicit value here.
disable_auto_compactions: boolDisable background compaction.
disable_wal: boolSkip the write-ahead log (rocksdb_writeoptions_disable_WAL).
sync_writes: boolFsync the write-ahead log entry of every write before it returns
(rocksdb_writeoptions_set_sync).
A WriteBatch::commit that returns is then durable: RocksDB flushes
and fsyncs the WAL entry inside rocksdb_write. Only meaningful with
the WAL enabled — with disable_wal: true there is nothing to sync
and the write returns after the MemTable insert. The blob index sets
this so a returning PutBlobs means the locators are on disk, which
is what the durability contract of the segment tier is written
against (segment records are fdatasynced before the commit, and the
commit must not silently lag them).
scan_async_io: boolSubmit scan-iterator block reads asynchronously via io_uring
(ReadOptions::async_io). Also enabled process-wide by
WARATAH_SCAN_ASYNC_IO=1. Engages for sequential iteration (forward
scans, the warm pass); random seek patterns are unaffected. Requires
the library built with io_uring support (ROCKSDB_IOURING_PRESENT);
silent synchronous fallback otherwise.
pin_index_in_cache: boolCache SST index/filter blocks in the block cache and pin them there
(cache_index_and_filter_blocks + unpartitioned_pinning = kAll).
Also enabled process-wide by WARATAH_PIN_INDEX=1. Under the default
false, index blocks live in table-reader heap memory — resident for
immortal readers, but invisible to the block cache. Pinning is
read-path state: it applies to newly opened stores and needs no data
rewrite. pin_top_level_index_and_filter would be the wrong knob here:
it governs partitioned indexes only, and every waratah index is the
default binary-search (unpartitioned) kind.
bloom_filter_bits_per_key: Option<u8>Bloom-filter bits per key attached to the SST table factory (None
= no filter policy).
The policy is created once at open and shared by every column family in that DB. Point-lookup stores (the blob index) enable it; the scan-heavy hexastore and registry dictionaries leave it off. Ten bits per key is the standard false-positive / memory trade-off.
Implementations§
Source§impl RocksDbTuning
impl RocksDbTuning
Sourcepub fn bulk_ingest(disable_wal: bool) -> Self
pub fn bulk_ingest(disable_wal: bool) -> Self
Offline ingest: large buffers, extra MemTables, no background compact.
Sourcepub fn registry_node() -> Self
pub fn registry_node() -> Self
Registry node: normal buffers, larger block cache to avoid evictions.
Sourcepub fn blob_index() -> Self
pub fn blob_index() -> Self
Blob index: point lookups, not scans.
The blob index maps a 16-byte content hash to either an inline payload or a segment locator. Both are point lookups, so the tuning is the opposite of the registry dictionary’s: 4 KiB blocks (the value is usually one block), a dedicated 64 MiB cache (the index is small but the cache must be isolated from the dictionary’s 256 MiB), and a Bloom filter to skip SSTs that cannot contain the key. The default level compaction applies; the index is append-only, so the write amplification is a one-time import cost.
Writes are synchronous: segment records are fdatasynced BEFORE the
locator commit, and the commit itself must not lag them in a crash —
an async-WAL commit that returns before its WAL entry reaches disk
would break “a durable locator implies durable bytes” from the other
side. One fsync per PutBlobs batch is also strictly cheaper than
the per-blob-file fsync this store replaced.
Trait Implementations§
Source§impl Clone for RocksDbTuning
impl Clone for RocksDbTuning
Source§fn clone(&self) -> RocksDbTuning
fn clone(&self) -> RocksDbTuning
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more