mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 00:01:24 +01:00
make all caches individually configurable
Also: * Removes the `cache_capacity_modifier` option * Renames the `pdu_cache_capacity` option to `cache.pdu`
This commit is contained in:
parent
9fab7538a0
commit
1148c6004f
4 changed files with 65 additions and 110 deletions
|
|
@ -46,11 +46,8 @@ pub(crate) struct Config {
|
|||
pub(crate) database: DatabaseConfig,
|
||||
#[serde(default)]
|
||||
pub(crate) federation: FederationConfig,
|
||||
|
||||
#[serde(default = "default_cache_capacity_modifier")]
|
||||
pub(crate) cache_capacity_modifier: f64,
|
||||
#[serde(default = "default_pdu_cache_capacity")]
|
||||
pub(crate) pdu_cache_capacity: usize,
|
||||
#[serde(default)]
|
||||
pub(crate) cache: CacheConfig,
|
||||
#[serde(default = "default_cleanup_second_interval")]
|
||||
pub(crate) cleanup_second_interval: u32,
|
||||
#[serde(default = "default_max_request_size")]
|
||||
|
|
@ -77,6 +74,38 @@ pub(crate) struct Config {
|
|||
pub(crate) emergency_password: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(deny_unknown_fields, default)]
|
||||
pub(crate) struct CacheConfig {
|
||||
pub(crate) pdu: usize,
|
||||
pub(crate) auth_chain: usize,
|
||||
pub(crate) short_eventid: usize,
|
||||
pub(crate) eventid_short: usize,
|
||||
pub(crate) statekey_short: usize,
|
||||
pub(crate) short_statekey: usize,
|
||||
pub(crate) server_visibility: usize,
|
||||
pub(crate) user_visibility: usize,
|
||||
pub(crate) state_info: usize,
|
||||
pub(crate) roomid_spacechunk: usize,
|
||||
}
|
||||
|
||||
impl Default for CacheConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
pdu: 150_000,
|
||||
auth_chain: 100_000,
|
||||
short_eventid: 100_000,
|
||||
eventid_short: 100_000,
|
||||
statekey_short: 100_000,
|
||||
short_statekey: 100_000,
|
||||
server_visibility: 100,
|
||||
user_visibility: 100,
|
||||
state_info: 100,
|
||||
roomid_spacechunk: 200,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub(crate) struct ServerDiscovery {
|
||||
|
|
@ -427,19 +456,11 @@ fn default_db_cache_capacity_mb() -> f64 {
|
|||
300.0
|
||||
}
|
||||
|
||||
fn default_cache_capacity_modifier() -> f64 {
|
||||
1.0
|
||||
}
|
||||
|
||||
#[cfg(feature = "rocksdb")]
|
||||
fn default_rocksdb_max_open_files() -> i32 {
|
||||
1000
|
||||
}
|
||||
|
||||
fn default_pdu_cache_capacity() -> usize {
|
||||
150_000
|
||||
}
|
||||
|
||||
fn default_cleanup_second_interval() -> u32 {
|
||||
// every minute
|
||||
60
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue