pub struct RocksDBTuningParameters {Show 16 fields
pub compaction_style: CompactionStyle,
pub optimize_compaction_memtable_budget: usize,
pub level_compaction_dynamic_level_bytes: bool,
pub universal_compaction_target_ratio: i32,
pub parallelism: Option<i32>,
pub compression_type: CompressionType,
pub bottommost_compression_type: CompressionType,
pub batch_size: usize,
pub retry_max_duration: Duration,
pub stats_log_interval_seconds: u32,
pub stats_persist_interval_seconds: u32,
pub point_lookup_block_cache_size_mb: Option<u32>,
pub shrink_buffers_by_ratio: usize,
pub write_buffer_manager_memory_bytes: Option<usize>,
pub write_buffer_manager_memory_fraction: Option<f64>,
pub write_buffer_manager_allow_stall: bool,
}Expand description
A set of parameters to tune RocksDB. This struct is plain-old-data, and is
used to update RocksDBConfig, which contains some dynamic value for some
parameters.
Fields§
§compaction_style: CompactionStyleRocksDB has 2 primary styles of compaction:
- The default, usually referred to as “level” compaction
- “universal”
Universal is simpler and for some workloads could be
better. Also, you can directly configure its space-amplification ratio
(using universal_compaction_target_ratio). However, its unclear
if the UPSERT workload is a good workload for universal compaction,
and its also might be the case that universal compaction uses significantly
more space temporarily while performing compaction.
For these reasons, the default is CompactionStyle::Level.
optimize_compaction_memtable_budget: usizeThe RocksDB api offers a single configuration method that sets some
reasonable defaults for heavy-write workloads, either
https://docs.rs/rocksdb/latest/rocksdb/struct.Options.html#method.optimize_level_style_compaction
or
https://docs.rs/rocksdb/latest/rocksdb/struct.Options.html#method.optimize_universal_style_compaction
depending on compaction_style. We ALSO enable this configuration, which is tuned
by the size of the memtable (basically the in-memory buffer used to avoid IO). The default
here is ~512MB, which is the default from here: https://github.com/facebook/rocksdb/blob/main/include/rocksdb/options.h#L102,
and about twice the global RocksDB default.
level_compaction_dynamic_level_bytes: boolThis option, when enabled, dynamically tunes
the size of the various LSM levels to put a bound on space-amplification.
With the default level-ratio of 10, this means space-amplification is
O(1.11 * the size of data). Note this is big-O notation, and the actual
amplification factor depends on the workload.
See https://www.eecg.toronto.edu/~stumm/Papers/Dong-CIDR-16.pdf for more details.
This option defaults to true, as its basically free saved-space, and only applies to
CompactionStyle::Level.
universal_compaction_target_ratio: i32The additional space-amplification used with universal compaction.
Only applies to CompactionStyle::Universal.
See compaction_style for more information.
parallelism: Option<i32>By default, RocksDB uses only 1 thread to perform compaction and other background tasks.
The default here is the number of cores, as mentioned by https://docs.rs/rocksdb/latest/rocksdb/struct.Options.html#method.increase_parallelism.
Note that this option is shared across all RocksDB instances that share a rocksdb::Env.
compression_type: CompressionTypeThe most important way to reduce space amplification in RocksDB is compression.
In RocksDB, data on disk is stored in an LSM tree. Because the higher layers (which are
smaller) will need to be read during reads that aren’t cached, we want a relatively
lightweight compression scheme, choosing Lz4 as the default, which is considered almost
always better than Snappy.
The meat of the data is stored in the largest, bottom layer, which can be configured
(using bottommost_compression_type) to use a more expensive compression scheme to save
more space. The default is Zstd, which many think has the best compression ratio. Note
that tuning the bottommost layer separately only makes sense when you have free cpu,
which we have in the case of the UPSERT usecase.
bottommost_compression_type: CompressionTypeSee compression_type for more information.
batch_size: usizeThe size of the multi_get and multi_put batches sent to RocksDB. The default is 1024.
retry_max_duration: DurationThe maximum duration for the retries when performing rocksdb actions in case of retry-able errors.
stats_log_interval_seconds: u32The interval to dump stats in LOG.
stats_persist_interval_seconds: u32The interval to persist stats into rocksdb.
point_lookup_block_cache_size_mb: Option<u32>The optional block cache size in MiB for optimizing rocksdb for point lookups. If not provided there will be no optimization. https://github.com/facebook/rocksdb/blob/main/include/rocksdb/options.h#L82-L85
shrink_buffers_by_ratio: usizeThe number of times by which unused buffers will be reduced. For example, if the number is 2, the buffers will be reduced to being twice as small, i.e. halved. Shrinking will be disabled if value is 0;
write_buffer_manager_memory_bytes: Option<usize>Optional write buffer manager bytes. This needs to be set to enable write buffer manager across all rocksdb instances
write_buffer_manager_memory_fraction: Option<f64>Optional write buffer manager memory limit as a percentage of cluster limit
write_buffer_manager_allow_stall: boolConfig to enable stalls with write buffer manager
Implementations§
Source§impl RocksDBTuningParameters
impl RocksDBTuningParameters
Sourcepub fn from_parameters(
compaction_style: CompactionStyle,
optimize_compaction_memtable_budget: usize,
level_compaction_dynamic_level_bytes: bool,
universal_compaction_target_ratio: i32,
parallelism: Option<i32>,
compression_type: CompressionType,
bottommost_compression_type: CompressionType,
batch_size: usize,
retry_max_duration: Duration,
stats_log_interval_seconds: u32,
stats_persist_interval_seconds: u32,
point_lookup_block_cache_size_mb: Option<u32>,
shrink_buffers_by_ratio: usize,
write_buffer_manager_memory_bytes: Option<usize>,
write_buffer_manager_memory_fraction: Option<f64>,
write_buffer_manager_allow_stall: bool,
) -> Result<RocksDBTuningParameters, Error>
pub fn from_parameters( compaction_style: CompactionStyle, optimize_compaction_memtable_budget: usize, level_compaction_dynamic_level_bytes: bool, universal_compaction_target_ratio: i32, parallelism: Option<i32>, compression_type: CompressionType, bottommost_compression_type: CompressionType, batch_size: usize, retry_max_duration: Duration, stats_log_interval_seconds: u32, stats_persist_interval_seconds: u32, point_lookup_block_cache_size_mb: Option<u32>, shrink_buffers_by_ratio: usize, write_buffer_manager_memory_bytes: Option<usize>, write_buffer_manager_memory_fraction: Option<f64>, write_buffer_manager_allow_stall: bool, ) -> Result<RocksDBTuningParameters, Error>
Build a RocksDBTuningParameters from strings and values from LD parameters.
Trait Implementations§
Source§impl Clone for RocksDBTuningParameters
impl Clone for RocksDBTuningParameters
Source§fn clone(&self) -> RocksDBTuningParameters
fn clone(&self) -> RocksDBTuningParameters
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RocksDBTuningParameters
impl Debug for RocksDBTuningParameters
Source§impl Default for RocksDBTuningParameters
impl Default for RocksDBTuningParameters
Source§fn default() -> RocksDBTuningParameters
fn default() -> RocksDBTuningParameters
Source§impl<'de> Deserialize<'de> for RocksDBTuningParameters
impl<'de> Deserialize<'de> for RocksDBTuningParameters
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RocksDBTuningParameters, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RocksDBTuningParameters, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for RocksDBTuningParameters
impl PartialEq for RocksDBTuningParameters
Source§impl Serialize for RocksDBTuningParameters
impl Serialize for RocksDBTuningParameters
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for RocksDBTuningParameters
Auto Trait Implementations§
impl Freeze for RocksDBTuningParameters
impl RefUnwindSafe for RocksDBTuningParameters
impl Send for RocksDBTuningParameters
impl Sync for RocksDBTuningParameters
impl Unpin for RocksDBTuningParameters
impl UnwindSafe for RocksDBTuningParameters
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,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§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();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§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();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§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();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§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();Source§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>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§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);Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
Source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign, for types that do not implement AddAssign.