add rocksdb_bottommost_compression_level config option
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
9a9f7b9c54
commit
a3c24bcc31
4 changed files with 24 additions and 1 deletions
|
@ -325,6 +325,16 @@ url_preview_check_root_domain = false
|
||||||
#
|
#
|
||||||
#rocksdb_compression_level = 32767
|
#rocksdb_compression_level = 32767
|
||||||
|
|
||||||
|
# Level of compression the specified compression algorithm for the bottommost level/data 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`.
|
||||||
|
#
|
||||||
|
# Since this is the bottommost level (generally old and least used data), it may be desirable to have a very
|
||||||
|
# high compression level here as it's lesss likely for this data to be used. Research your chosen compression algorithm.
|
||||||
|
#
|
||||||
|
#rocksdb_bottommost_compression_level = 32767
|
||||||
|
|
||||||
# Whether to enable RocksDB "bottommost_compression".
|
# Whether to enable RocksDB "bottommost_compression".
|
||||||
# At the expense of more CPU usage, this will further compress the database to reduce more storage.
|
# 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.
|
# It is recommended to use ZSTD compression with this for best compression results.
|
||||||
|
|
|
@ -123,6 +123,8 @@ pub struct Config {
|
||||||
pub rocksdb_compression_algo: String,
|
pub rocksdb_compression_algo: String,
|
||||||
#[serde(default = "default_rocksdb_compression_level")]
|
#[serde(default = "default_rocksdb_compression_level")]
|
||||||
pub rocksdb_compression_level: i32,
|
pub rocksdb_compression_level: i32,
|
||||||
|
#[serde(default = "default_rocksdb_bottommost_compression_level")]
|
||||||
|
pub rocksdb_bottommost_compression_level: i32,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub rocksdb_bottommost_compression: bool,
|
pub rocksdb_bottommost_compression: bool,
|
||||||
|
|
||||||
|
@ -368,6 +370,10 @@ impl fmt::Display for Config {
|
||||||
("RocksDB Compression Algorithm", &self.rocksdb_compression_algo),
|
("RocksDB Compression Algorithm", &self.rocksdb_compression_algo),
|
||||||
#[cfg(feature = "rocksdb")]
|
#[cfg(feature = "rocksdb")]
|
||||||
("RocksDB Compression Level", &self.rocksdb_compression_level.to_string()),
|
("RocksDB Compression Level", &self.rocksdb_compression_level.to_string()),
|
||||||
|
(
|
||||||
|
"RocksDB Bottommost Compression Level",
|
||||||
|
&self.rocksdb_bottommost_compression_level.to_string(),
|
||||||
|
),
|
||||||
#[cfg(feature = "rocksdb")]
|
#[cfg(feature = "rocksdb")]
|
||||||
(
|
(
|
||||||
"RocksDB Bottommost Level Compression",
|
"RocksDB Bottommost Level Compression",
|
||||||
|
@ -479,6 +485,11 @@ fn default_rocksdb_compression_algo() -> String { "zstd".to_owned() }
|
||||||
/// compression level as they all differ. See their `kDefaultCompressionLevel`.
|
/// compression level as they all differ. See their `kDefaultCompressionLevel`.
|
||||||
fn default_rocksdb_compression_level() -> i32 { 32767 }
|
fn default_rocksdb_compression_level() -> i32 { 32767 }
|
||||||
|
|
||||||
|
/// Default RocksDB compression level 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`.
|
||||||
|
fn default_rocksdb_bottommost_compression_level() -> i32 { 32767 }
|
||||||
|
|
||||||
// I know, it's a great name
|
// I know, it's a great name
|
||||||
pub(crate) fn default_default_room_version() -> RoomVersionId { RoomVersionId::V10 }
|
pub(crate) fn default_default_room_version() -> RoomVersionId { RoomVersionId::V10 }
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ fn db_options(rocksdb_cache: &rust_rocksdb::Cache, config: &Config) -> rust_rock
|
||||||
db_opts.set_bottommost_zstd_max_train_bytes(0, true);
|
db_opts.set_bottommost_zstd_max_train_bytes(0, true);
|
||||||
|
|
||||||
// -14 w_bits is only read by zlib.
|
// -14 w_bits is only read by zlib.
|
||||||
db_opts.set_bottommost_compression_options(-14, config.rocksdb_compression_level, 0, 0, true);
|
db_opts.set_bottommost_compression_options(-14, config.rocksdb_bottommost_compression_level, 0, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -14 w_bits is only read by zlib.
|
// -14 w_bits is only read by zlib.
|
||||||
|
|
|
@ -373,6 +373,8 @@ impl Service<'_> {
|
||||||
|
|
||||||
pub fn rocksdb_compression_level(&self) -> i32 { self.config.rocksdb_compression_level }
|
pub fn rocksdb_compression_level(&self) -> i32 { self.config.rocksdb_compression_level }
|
||||||
|
|
||||||
|
pub fn rocksdb_bottommost_compression_level(&self) -> i32 { self.config.rocksdb_bottommost_compression_level }
|
||||||
|
|
||||||
pub fn prevent_media_downloads_from(&self) -> &[OwnedServerName] { &self.config.prevent_media_downloads_from }
|
pub fn prevent_media_downloads_from(&self) -> &[OwnedServerName] { &self.config.prevent_media_downloads_from }
|
||||||
|
|
||||||
pub fn ip_range_denylist(&self) -> &[String] { &self.config.ip_range_denylist }
|
pub fn ip_range_denylist(&self) -> &[String] { &self.config.ip_range_denylist }
|
||||||
|
|
Loading…
Add table
Reference in a new issue