Skip to main content

RocksDbTuning

Struct RocksDbTuning 

Source
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: usize

MemTable write-buffer size (rocksdb_options_set_write_buffer_size).

§max_write_buffer_number: i32

Number of MemTables (rocksdb_options_set_max_write_buffer_number).

§block_cache_bytes: usize

Block cache size (rocksdb_cache_create_lru).

§block_size_bytes: usize

SST 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: usize

Fixed 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: bool

Disable background compaction.

§disable_wal: bool

Skip the write-ahead log (rocksdb_writeoptions_disable_WAL).

§sync_writes: bool

Fsync 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: bool

Submit 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: bool

Cache 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

Source

pub fn bulk_ingest(disable_wal: bool) -> Self

Offline ingest: large buffers, extra MemTables, no background compact.

Source

pub fn registry_node() -> Self

Registry node: normal buffers, larger block cache to avoid evictions.

Source

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

Source§

fn clone(&self) -> RocksDbTuning

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RocksDbTuning

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RocksDbTuning

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for RocksDbTuning

Source§

fn eq(&self, other: &RocksDbTuning) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for RocksDbTuning

Source§

impl Eq for RocksDbTuning

Source§

impl StructuralPartialEq for RocksDbTuning

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,