add configuration for rocksdb direct-io enablement
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
f4a2b39d55
commit
5d76db8f19
3 changed files with 12 additions and 2 deletions
|
@ -384,6 +384,10 @@ allow_profile_lookup_federation_requests = true
|
||||||
# Defaults to false
|
# Defaults to false
|
||||||
#rocksdb_optimize_for_spinning_disks = false
|
#rocksdb_optimize_for_spinning_disks = false
|
||||||
|
|
||||||
|
# Enables direct-io to increase database performance. This is enabled by default. Set this option to false if the
|
||||||
|
# database resides on a filesystem which does not support direct-io.
|
||||||
|
#rocksdb_direct_io = true
|
||||||
|
|
||||||
# RocksDB log level. This is not the same as conduwuit's log level. This is the log level for the RocksDB engine/library
|
# RocksDB log level. This is not the same as conduwuit's log level. This is the log level for the RocksDB engine/library
|
||||||
# which show up in your database folder/path as `LOG` files. Defaults to error. conduwuit will typically log RocksDB errors as normal.
|
# which show up in your database folder/path as `LOG` files. Defaults to error. conduwuit will typically log RocksDB errors as normal.
|
||||||
#rocksdb_log_level = "error"
|
#rocksdb_log_level = "error"
|
||||||
|
|
|
@ -218,6 +218,8 @@ pub(crate) struct Config {
|
||||||
pub(crate) rocksdb_log_time_to_roll: usize,
|
pub(crate) rocksdb_log_time_to_roll: usize,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub(crate) rocksdb_optimize_for_spinning_disks: bool,
|
pub(crate) rocksdb_optimize_for_spinning_disks: bool,
|
||||||
|
#[serde(default = "true_fn")]
|
||||||
|
pub(crate) rocksdb_direct_io: bool,
|
||||||
#[serde(default = "default_rocksdb_parallelism_threads")]
|
#[serde(default = "default_rocksdb_parallelism_threads")]
|
||||||
pub(crate) rocksdb_parallelism_threads: usize,
|
pub(crate) rocksdb_parallelism_threads: usize,
|
||||||
#[serde(default = "default_rocksdb_max_log_files")]
|
#[serde(default = "default_rocksdb_max_log_files")]
|
||||||
|
@ -703,6 +705,8 @@ impl fmt::Display for Config {
|
||||||
&self.rocksdb_optimize_for_spinning_disks.to_string(),
|
&self.rocksdb_optimize_for_spinning_disks.to_string(),
|
||||||
),
|
),
|
||||||
#[cfg(feature = "rocksdb")]
|
#[cfg(feature = "rocksdb")]
|
||||||
|
("RocksDB Direct-IO", &self.rocksdb_direct_io.to_string()),
|
||||||
|
#[cfg(feature = "rocksdb")]
|
||||||
("RocksDB Parallelism Threads", &self.rocksdb_parallelism_threads.to_string()),
|
("RocksDB Parallelism Threads", &self.rocksdb_parallelism_threads.to_string()),
|
||||||
#[cfg(feature = "rocksdb")]
|
#[cfg(feature = "rocksdb")]
|
||||||
("RocksDB Compression Algorithm", &self.rocksdb_compression_algo),
|
("RocksDB Compression Algorithm", &self.rocksdb_compression_algo),
|
||||||
|
|
|
@ -36,8 +36,10 @@ pub(crate) fn db_options(config: &Config, env: &mut Env, row_cache: &Cache, col_
|
||||||
|
|
||||||
// IO
|
// IO
|
||||||
opts.set_manual_wal_flush(true);
|
opts.set_manual_wal_flush(true);
|
||||||
opts.set_use_direct_reads(true);
|
if config.rocksdb_direct_io {
|
||||||
opts.set_use_direct_io_for_flush_and_compaction(true);
|
opts.set_use_direct_reads(true);
|
||||||
|
opts.set_use_direct_io_for_flush_and_compaction(true);
|
||||||
|
}
|
||||||
if config.rocksdb_optimize_for_spinning_disks {
|
if config.rocksdb_optimize_for_spinning_disks {
|
||||||
// speeds up opening DB on hard drives
|
// speeds up opening DB on hard drives
|
||||||
opts.set_skip_checking_sst_file_sizes_on_db_open(true);
|
opts.set_skip_checking_sst_file_sizes_on_db_open(true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue