mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-12-04 20:08:10 +00:00
Add a cache for read receipts and queued transactions
This commit is contained in:
parent
b94eeb9580
commit
4f69fd01d1
|
@ -158,6 +158,10 @@
|
||||||
#
|
#
|
||||||
#eventidshort_cache_capacity = varies by system
|
#eventidshort_cache_capacity = varies by system
|
||||||
|
|
||||||
|
# This item is undocumented. Please contribute documentation for it.
|
||||||
|
#
|
||||||
|
#eventid_pdu_cache_capacity = varies by system
|
||||||
|
|
||||||
# This item is undocumented. Please contribute documentation for it.
|
# This item is undocumented. Please contribute documentation for it.
|
||||||
#
|
#
|
||||||
#shortstatekey_cache_capacity = varies by system
|
#shortstatekey_cache_capacity = varies by system
|
||||||
|
@ -166,6 +170,14 @@
|
||||||
#
|
#
|
||||||
#statekeyshort_cache_capacity = varies by system
|
#statekeyshort_cache_capacity = varies by system
|
||||||
|
|
||||||
|
# This item is undocumented. Please contribute documentation for it.
|
||||||
|
#
|
||||||
|
#servernameevent_data_cache_capacity =
|
||||||
|
|
||||||
|
# This item is undocumented. Please contribute documentation for it.
|
||||||
|
#
|
||||||
|
#readreceipt_cache_capacity =
|
||||||
|
|
||||||
# This item is undocumented. Please contribute documentation for it.
|
# This item is undocumented. Please contribute documentation for it.
|
||||||
#
|
#
|
||||||
#server_visibility_cache_capacity = varies by system
|
#server_visibility_cache_capacity = varies by system
|
||||||
|
|
|
@ -210,6 +210,12 @@ pub struct Config {
|
||||||
#[serde(default = "default_statekeyshort_cache_capacity")]
|
#[serde(default = "default_statekeyshort_cache_capacity")]
|
||||||
pub statekeyshort_cache_capacity: u32,
|
pub statekeyshort_cache_capacity: u32,
|
||||||
|
|
||||||
|
#[serde(default = "default_servernameevent_data_cache_capacity")]
|
||||||
|
pub servernameevent_data_cache_capacity: u32,
|
||||||
|
|
||||||
|
#[serde(default = "default_readreceipt_cache_capacity")]
|
||||||
|
pub readreceipt_cache_capacity: u32,
|
||||||
|
|
||||||
/// default: varies by system
|
/// default: varies by system
|
||||||
#[serde(default = "default_server_visibility_cache_capacity")]
|
#[serde(default = "default_server_visibility_cache_capacity")]
|
||||||
pub server_visibility_cache_capacity: u32,
|
pub server_visibility_cache_capacity: u32,
|
||||||
|
@ -2051,6 +2057,10 @@ fn default_shortstatekey_cache_capacity() -> u32 { parallelism_scaled_u32(10_000
|
||||||
|
|
||||||
fn default_statekeyshort_cache_capacity() -> u32 { parallelism_scaled_u32(10_000).saturating_add(100_000) }
|
fn default_statekeyshort_cache_capacity() -> u32 { parallelism_scaled_u32(10_000).saturating_add(100_000) }
|
||||||
|
|
||||||
|
fn default_servernameevent_data_cache_capacity() -> u32 { parallelism_scaled_u32(100_000).saturating_add(500_000) }
|
||||||
|
|
||||||
|
fn default_readreceipt_cache_capacity() -> u32 { parallelism_scaled_u32(25_000).saturating_add(100_000) }
|
||||||
|
|
||||||
fn default_server_visibility_cache_capacity() -> u32 { parallelism_scaled_u32(500) }
|
fn default_server_visibility_cache_capacity() -> u32 { parallelism_scaled_u32(500) }
|
||||||
|
|
||||||
fn default_user_visibility_cache_capacity() -> u32 { parallelism_scaled_u32(1000) }
|
fn default_user_visibility_cache_capacity() -> u32 { parallelism_scaled_u32(1000) }
|
||||||
|
|
|
@ -170,6 +170,24 @@ pub(crate) fn cf_options(
|
||||||
cache_size(cfg, cfg.statekeyshort_cache_capacity, 1024)?,
|
cache_size(cfg, cfg.statekeyshort_cache_capacity, 1024)?,
|
||||||
),
|
),
|
||||||
|
|
||||||
|
"servernameevent_data" => set_table_with_new_cache(
|
||||||
|
&mut opts,
|
||||||
|
cfg,
|
||||||
|
cache,
|
||||||
|
name,
|
||||||
|
cache_size(cfg, cfg.servernameevent_data_cache_capacity, 128)?
|
||||||
|
// Raw average value size = 102, key size = 34
|
||||||
|
),
|
||||||
|
|
||||||
|
"readreceiptid_readreceipt" => set_table_with_new_cache(
|
||||||
|
&mut opts,
|
||||||
|
cfg,
|
||||||
|
cache,
|
||||||
|
name,
|
||||||
|
cache_size(cfg, cfg.readreceipt_cache_capacity, 192)?
|
||||||
|
// Raw average value size = 90, key size = 70
|
||||||
|
),
|
||||||
|
|
||||||
"eventid_outlierpdu" => {
|
"eventid_outlierpdu" => {
|
||||||
set_table_with_new_cache(&mut opts, cfg, cache, name, cache_size(cfg, cfg.pdu_cache_capacity, 1536)?);
|
set_table_with_new_cache(&mut opts, cfg, cache, name, cache_size(cfg, cfg.pdu_cache_capacity, 1536)?);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue