Skip to content
Snippets Groups Projects
Commit 5d76db8f authored by Jason Volk's avatar Jason Volk Committed by 🥺
Browse files

add configuration for rocksdb direct-io enablement


Signed-off-by: default avatarJason Volk <jason@zemos.net>
parent f4a2b39d
No related branches found
No related tags found
No related merge requests found
...@@ -384,6 +384,10 @@ allow_profile_lookup_federation_requests = true ...@@ -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 { ...@@ -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 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { ...@@ -703,6 +705,8 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
&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_ ...@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment