mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-06-26 20:26:36 +02:00
change rocksdb stats level to 3
scale rocksdb background jobs and subcompactions change rocksdb default error level to info from error delete unused num_threads function fix warns from cargo
This commit is contained in:
parent
da659f17ab
commit
af5330f642
3 changed files with 8 additions and 22 deletions
|
@ -990,7 +990,7 @@
|
|||
# 3 to 5 = Statistics with possible performance impact.
|
||||
# 6 = All statistics.
|
||||
#
|
||||
#rocksdb_stats_level = 1
|
||||
#rocksdb_stats_level = 3
|
||||
|
||||
# This is a password that can be configured that will let you login to the
|
||||
# server bot account (currently `@conduit`) for emergency troubleshooting
|
||||
|
|
|
@ -1155,7 +1155,7 @@ pub struct Config {
|
|||
/// 3 to 5 = Statistics with possible performance impact.
|
||||
/// 6 = All statistics.
|
||||
///
|
||||
/// default: 1
|
||||
/// default: 3
|
||||
#[serde(default = "default_rocksdb_stats_level")]
|
||||
pub rocksdb_stats_level: u8,
|
||||
|
||||
|
@ -2199,7 +2199,7 @@ fn default_typing_client_timeout_max_s() -> u64 { 45 }
|
|||
|
||||
fn default_rocksdb_recovery_mode() -> u8 { 1 }
|
||||
|
||||
fn default_rocksdb_log_level() -> String { "error".to_owned() }
|
||||
fn default_rocksdb_log_level() -> String { "info".to_owned() }
|
||||
|
||||
fn default_rocksdb_log_time_to_roll() -> usize { 0 }
|
||||
|
||||
|
@ -2231,7 +2231,7 @@ fn default_rocksdb_compression_level() -> i32 { 32767 }
|
|||
#[allow(clippy::doc_markdown)]
|
||||
fn default_rocksdb_bottommost_compression_level() -> i32 { 32767 }
|
||||
|
||||
fn default_rocksdb_stats_level() -> u8 { 1 }
|
||||
fn default_rocksdb_stats_level() -> u8 { 3 }
|
||||
|
||||
// I know, it's a great name
|
||||
#[must_use]
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
use std::{cmp, convert::TryFrom};
|
||||
|
||||
use conduwuit::{Config, Result, utils};
|
||||
use conduwuit::{Config, Result};
|
||||
use rocksdb::{Cache, DBRecoveryMode, Env, LogLevel, Options, statistics::StatsLevel};
|
||||
|
||||
use conduwuit::config::{parallelism_scaled_i32, parallelism_scaled_u32};
|
||||
use super::{cf_opts::cache_size_f64, logger::handle as handle_log};
|
||||
|
||||
/// Create database-wide options suitable for opening the database. This also
|
||||
|
@ -23,8 +21,8 @@ pub(crate) fn db_options(config: &Config, env: &Env, row_cache: &Cache) -> Resul
|
|||
set_logging_defaults(&mut opts, config);
|
||||
|
||||
// Processing
|
||||
opts.set_max_background_jobs(num_threads::<i32>(config)?);
|
||||
opts.set_max_subcompactions(num_threads::<u32>(config)?);
|
||||
opts.set_max_background_jobs(parallelism_scaled_i32(1));
|
||||
opts.set_max_subcompactions(parallelism_scaled_u32(1));
|
||||
opts.set_avoid_unnecessary_blocking_io(true);
|
||||
opts.set_max_file_opening_threads(0);
|
||||
|
||||
|
@ -126,15 +124,3 @@ fn set_logging_defaults(opts: &mut Options, config: &Config) {
|
|||
opts.set_callback_logger(rocksdb_log_level, &handle_log);
|
||||
}
|
||||
}
|
||||
|
||||
fn num_threads<T: TryFrom<usize>>(config: &Config) -> Result<T> {
|
||||
const MIN_PARALLELISM: usize = 2;
|
||||
|
||||
let requested = if config.rocksdb_parallelism_threads != 0 {
|
||||
config.rocksdb_parallelism_threads
|
||||
} else {
|
||||
utils::available_parallelism()
|
||||
};
|
||||
|
||||
utils::math::try_into::<T, usize>(cmp::max(MIN_PARALLELISM, requested))
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue