pub struct Rocksdb {Show 27 fields
pub cache_capacity_mb: f64,
pub write_buffer_capacity_mb: f64,
pub log_level: String,
pub log_stderr: bool,
pub max_log_file_size: usize,
pub log_time_to_roll: usize,
pub optimize_for_spinning_disks: bool,
pub direct_io: bool,
pub parallelism_threads: usize,
pub max_log_files: usize,
pub compression_algo: String,
pub compression_level: i32,
pub bottommost_compression_level: i32,
pub bottommost_compression: bool,
pub recovery_mode: u8,
pub paranoid_file_checks: bool,
pub checksums: bool,
pub atomic_flush: bool,
pub repair: bool,
pub read_only: bool,
pub secondary: bool,
pub compaction_prio_idle: bool,
pub compaction_ioprio_idle: bool,
pub compaction: bool,
pub stats_level: u8,
pub never_drop_columns: bool,
pub allow_fallocate: bool,
}Expand description
RocksDB storage engine
Tunes the RocksDB engine behind the database at database_path. Every
key is read when the database opens, so changes need a restart. The
defaults assume SSD or NVMe storage, and most keys only trade memory,
threads or log volume for speed or diagnostics.
The recovery keys are different: recovery_mode 2 or 3 and repair
can discard data, so back up database_path first and revert them once
the server starts cleanly.
Tips:
- On btrfs or ZFS set
allow_fallocate = false; startup warns while it is left on there. On ZFS also setdirect_io = false. recovery_modeaccepts 0 to 3; a larger value panics at startup.cache.capacity_modifieralso scaleswrite_buffer_capacity_mb.
Fields§
§cache_capacity_mb: f64Sets the memory available to database read caches as a float in megabytes.
Increasing this may improve performance when memory is available; like individual LRU caches, the default scales with CPU core count to 128.0 + (64.0
- CPU core count).
default: varies by system legacy: db_cache_capacity_mb
write_buffer_capacity_mb: f64Sets the memory available to database write caches as a float in megabytes.
Increasing this may improve performance when memory is available; like individual LRU caches, the default scales with CPU core count to 48.0 + (4.0 * CPU core count).
default: varies by system legacy: db_write_buffer_capacity_mb
log_level: StringSets the log level for RocksDB LOG files in the database directory.
This differs from the application log level; tuwunel still reports RocksDB errors through tracing or panics on severe errors for safety.
default: “error” legacy: rocksdb_log_level
log_stderr: boolRoutes RocksDB log messages to standard error.
rocksdb.log_level still filters the emitted records. When disabled,
RocksDB uses the application’s callback logger instead.
legacy: rocksdb_log_stderr
max_log_file_size: usizeSets the maximum RocksDB LOG file size before rotation.
Accepts an integer byte count or a string with SI/IEC suffix such as “4 MiB”.
default: 4194304 legacy: rocksdb_max_log_file_size
log_time_to_roll: usizeTime in seconds before RocksDB will forcibly rotate logs.
default: 0 legacy: rocksdb_log_time_to_roll
optimize_for_spinning_disks: boolUses RocksDB tunings tailored to spinning disks (HDDs).
Leave this disabled on NVMe or SSD storage. When enabled, RocksDB skips
compaction readahead and parallel file-open threads at startup. This does not
affect Direct IO; see rocksdb.direct_io.
legacy: rocksdb_optimize_for_spinning_disks
direct_io: boolEnables direct-io to increase database performance via unbuffered I/O.
For more details about direct I/O and RockDB, see: https://github.com/facebook/rocksdb/wiki/Direct-IO
Set this option to false if the database resides on a filesystem which does not support direct-io like FUSE, or any form of complex filesystem setup such as possibly ZFS. legacy: rocksdb_direct_io
parallelism_threads: usizeSets the number of RocksDB threads for cleanup, sync, flush, and compaction.
The stored value 0 selects the available logical thread count, with a minimum of two.
default: 0 legacy: rocksdb_parallelism_threads
max_log_files: usizeSets the maximum number of RocksDB LOG files retained.
This must be at least 1, never 0. The default is 3 because these logs are mainly useful for troubleshooting or debugging RocksDB bugs.
default: 3 legacy: rocksdb_max_log_files
compression_algo: StringSets the RocksDB database compression algorithm.
Available options are “zstd”, “bz2”, “lz4”, or “none”, which disables compression. ZSTD balances speed, storage, IO amplification, and CPU usage; LZ4 offers more performance and lower CPU usage with less compression and more storage use. See https://github.com/facebook/rocksdb/wiki/Compression for details.
default: “zstd” legacy: rocksdb_compression_algo
compression_level: i32Level of compression the specified compression algorithm for RocksDB to use.
Default is 32767, which is internally read by RocksDB as the default
magic number and translated to the library’s default compression level
as they all differ. See their kDefaultCompressionLevel.
Note when using the default value we may override it with a setting tailored specifically tuwunel.
default: 32767 legacy: rocksdb_compression_level
bottommost_compression_level: i32Sets the compression level for the bottommost RocksDB data.
The default 32767 is RocksDB’s kDefaultCompressionLevel, translated to the
selected library’s default level; tuwunel may override it with a tailored
setting. Bottommost data is generally old and less frequently accessed, so
higher compression may be useful; research the chosen algorithm.
default: 32767 legacy: rocksdb_bottommost_compression_level
bottommost_compression: boolWhether to enable RocksDB’s “bottommost_compression”.
At the expense of more CPU usage, this will further compress the database to reduce more storage. It is recommended to use ZSTD compression with this for best compression results. This may be useful if you’re trying to reduce storage usage from the database.
See https://github.com/facebook/rocksdb/wiki/Compression for more details. legacy: rocksdb_bottommost_compression
recovery_mode: u8Sets the database recovery mode for RocksDB WAL corruption.
When corruption prevents startup, use mode 2 (PointInTime) to recover to the last good state, seconds or minutes before the crash. Clients may need “clear-cache & reload” after this rollback. After recovery succeeds, reset the mode to its default and restart. In some cases the corruption error persists for at least 30 minutes of operation in PointInTime mode.
Only as a last resort if PointInTime fails, try mode 3 (SkipAnyCorruptedRecord), which may leave the server inconsistent. Default mode 1 (TolerateCorruptedTailRecords) drops only the last entry if corrupted during shutdown, with an extraordinarily low risk of desynchronizing clients. Mode 0 (AbsoluteConsistency) disables all silent rollback. See https://github.com/facebook/rocksdb/wiki/WAL-Recovery-Modes for mode details and https://tuwunel.chat/troubleshooting.html#database-corruption for recovery guidance.
default: 1 legacy: rocksdb_recovery_mode
paranoid_file_checks: boolEnables paranoid SST file checks.
Additional safety checks may improve database consistency at a performance cost; see the RocksDB documentation for details: https://github.com/facebook/rocksdb/wiki/Online-Verification#columnfamilyoptionsparanoid_file_checks
legacy: rocksdb_paranoid_file_checks
checksums: boolEnables runtime checksum verification in RocksDB.
Checksums are enabled by default and usually hardware accelerated with low overhead. Older or slower platforms may gain performance by disabling them.
default: true legacy: rocksdb_checksums
atomic_flush: boolEnables RocksDB atomic flush mode.
This option is not intended for users and may be removed or ignored in future versions. It may improve database integrity at the cost of performance.
legacy: rocksdb_atomic_flush
repair: boolEnables database repair for RocksDB SST corruption.
Use this when the server reports corruption while running or panics, especially for errors containing SST after startup; if startup fails, try recovery mode first. Back up the database directory before running repair. Disable repair mode and restart the server after repair finishes. See https://tuwunel.chat/troubleshooting.html#database-corruption for recovery details.
legacy: rocksdb_repair
read_only: boolOpens RocksDB in read-only mode.
Writes are rejected and missing column families cannot be created. This mode is disabled by default. legacy: rocksdb_read_only
secondary: boolOpens RocksDB as a secondary follower of a primary instance.
Writes are rejected while the primary’s latest WAL can be replayed into this instance’s view. Missing column families cannot be created. legacy: rocksdb_secondary
compaction_prio_idle: boolEnables idle CPU priority for the compaction thread.
This is disabled by default to prevent compaction from falling too far behind on busy systems.
legacy: rocksdb_compaction_prio_idle
compaction_ioprio_idle: boolEnables idle IO priority for the compaction thread.
This is enabled by default and usually advisable to prevent unexpected server lag.
legacy: rocksdb_compaction_ioprio_idle
compaction: boolEnables RocksDB compaction.
You should never need to disable this; if troubleshooting or a bug appears to require it, contact the tuwunel Matrix room with details. Disabling compaction causes explosive database growth, gradually poor performance, excessive disk reads and writes, and slower shutdowns and startups.
legacy: rocksdb_compaction
stats_level: u8Sets the level of database statistics collection from 0 to 6.
Some admin commands that display database statistics require this setting; higher levels may affect performance. Level 0 disables statistics, level 1 disables them in release mode and is the default, levels 2 to 3 have no performance impact, levels 3 to 5 may affect performance, and level 6 collects all statistics.
default: 1 legacy: rocksdb_stats_level
never_drop_columns: boolIgnores the list of dropped columns set by developers.
This should be set to true when knowingly moving between versions in ways which are not recommended or otherwise forbidden, or for diagnostic and development purposes; requiring preservation across such movements.
The developer’s list of dropped columns is meant to safely reduce space by erasing data no longer in use. If this is set to true that storage will not be reclaimed as intended.
default: false legacy: rocksdb_never_drop_columns
allow_fallocate: boolAllows RocksDB to preallocate WAL logs.
Normally, RocksDB allocates certain types of files by calling
fallocate, writing the file contents, then truncating the logs to the
proper size. This causes pathological disk space usage on btrfs due to
how it interacts with its Copy-on-Write implementation. On ZFS,
fallocate(2) for preallocation is unsupported and returns EOPNOTSUPP;
only FALLOC_FL_PUNCH_HOLE and FALLOC_FL_ZERO_RANGE are implemented.
Set this to false if you run the server on btrfs or ZFS, and do not touch it otherwise.
default: true legacy: rocksdb_allow_fallocate
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Rocksdb
impl<'de> Deserialize<'de> for Rocksdb
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Rocksdb
impl RefUnwindSafe for Rocksdb
impl Send for Rocksdb
impl Sync for Rocksdb
impl Unpin for Rocksdb
impl UnsafeUnpin for Rocksdb
impl UnwindSafe for Rocksdb
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> ExpectInto for T
impl<T> ExpectInto for T
Source§impl<T> Expected for T
impl<T> Expected for T
Source§fn expected_add(self, rhs: Self) -> Selfwhere
Self: CheckedAdd + Sized,
fn expected_add(self, rhs: Self) -> Selfwhere
Self: CheckedAdd + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_sub(self, rhs: Self) -> Selfwhere
Self: CheckedSub + Sized,
fn expected_sub(self, rhs: Self) -> Selfwhere
Self: CheckedSub + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_mul(self, rhs: Self) -> Selfwhere
Self: CheckedMul + Sized,
fn expected_mul(self, rhs: Self) -> Selfwhere
Self: CheckedMul + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_div(self, rhs: Self) -> Selfwhere
Self: CheckedDiv + Sized,
fn expected_div(self, rhs: Self) -> Selfwhere
Self: CheckedDiv + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_rem(self, rhs: Self) -> Selfwhere
Self: CheckedRem + Sized,
fn expected_rem(self, rhs: Self) -> Selfwhere
Self: CheckedRem + Sized,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> JsonCastable<CanonicalJsonValue> for T
impl<T> JsonCastable<Value> for T
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
§fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
§fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
§fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
§fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
500 Internal Server responses. Read moreSource§impl<T> Tried for T
impl<T> Tried for T
Source§fn try_add(self, rhs: Self) -> Result<Self>where
Self: CheckedAdd + Sized,
fn try_add(self, rhs: Self) -> Result<Self>where
Self: CheckedAdd + Sized,
rhs with checked arithmetic. Read moreSource§fn try_sub(self, rhs: Self) -> Result<Self>where
Self: CheckedSub + Sized,
fn try_sub(self, rhs: Self) -> Result<Self>where
Self: CheckedSub + Sized,
rhs with checked arithmetic. Read moreSource§fn try_mul(self, rhs: Self) -> Result<Self>where
Self: CheckedMul + Sized,
fn try_mul(self, rhs: Self) -> Result<Self>where
Self: CheckedMul + Sized,
rhs with checked arithmetic. Read more