automatically scale conduwuit caches by CPU-core-count

This commit is contained in:
Jacob Taylor 2024-09-04 08:06:18 -07:00 committed by Aranjedeath
parent 032b199129
commit b9a8f8e6c7
2 changed files with 13 additions and 12 deletions

View File

@ -481,6 +481,7 @@ allow_profile_lookup_federation_requests = true
### Generic database options
# Set this to any float value to multiply conduwuit's in-memory LRU caches with.
# By default, the caches scale automatically with cpu-core-count.
# May be useful if you have significant memory to spare to increase performance.
#
# This was previously called `conduit_cache_capacity_modifier`
@ -490,7 +491,7 @@ allow_profile_lookup_federation_requests = true
# Set this to any float value in megabytes for conduwuit to tell the database engine that this much memory is available for database-related caches.
# May be useful if you have significant memory to spare to increase performance.
# Defaults to 256.0
# Defaults to 128.0 + (64.0 * CPU core count).
#db_cache_capacity_mb = 256.0

View File

@ -887,29 +887,29 @@ fn default_database_backups_to_keep() -> i16 { 1 }
fn default_database_backend() -> String { "rocksdb".to_owned() }
fn default_db_cache_capacity_mb() -> f64 { 256.0 }
fn default_db_cache_capacity_mb() -> f64 { 128.0 + (64.0 * (crate::utils::available_parallelism() as f64)) }
fn default_pdu_cache_capacity() -> u32 { 150_000 }
fn default_pdu_cache_capacity() -> u32 { 100_000 + (10_000 * crate::utils::available_parallelism() as u32) }
fn default_cache_capacity_modifier() -> f64 { 1.0 }
fn default_auth_chain_cache_capacity() -> u32 { 100_000 }
fn default_auth_chain_cache_capacity() -> u32 { 100_000 + (10_000 * crate::utils::available_parallelism() as u32) }
fn default_shorteventid_cache_capacity() -> u32 { 500_000 }
fn default_shorteventid_cache_capacity() -> u32 { 100_000 + (50_000 * crate::utils::available_parallelism() as u32) }
fn default_eventidshort_cache_capacity() -> u32 { 100_000 }
fn default_eventidshort_cache_capacity() -> u32 { 100_000 + (25_000 * crate::utils::available_parallelism() as u32) }
fn default_shortstatekey_cache_capacity() -> u32 { 100_000 }
fn default_shortstatekey_cache_capacity() -> u32 { 100_000 + (10_000 * crate::utils::available_parallelism() as u32) }
fn default_statekeyshort_cache_capacity() -> u32 { 100_000 }
fn default_statekeyshort_cache_capacity() -> u32 { 100_000 + (10_000 * crate::utils::available_parallelism() as u32) }
fn default_server_visibility_cache_capacity() -> u32 { 100 }
fn default_server_visibility_cache_capacity() -> u32 { 500 * crate::utils::available_parallelism() as u32 }
fn default_user_visibility_cache_capacity() -> u32 { 100 }
fn default_user_visibility_cache_capacity() -> u32 { 1000 * crate::utils::available_parallelism() as u32 }
fn default_stateinfo_cache_capacity() -> u32 { 100 }
fn default_stateinfo_cache_capacity() -> u32 { 1000 * crate::utils::available_parallelism() as u32 }
fn default_roomid_spacehierarchy_cache_capacity() -> u32 { 100 }
fn default_roomid_spacehierarchy_cache_capacity() -> u32 { 1000 * crate::utils::available_parallelism() as u32 }
fn default_dns_cache_entries() -> u32 { 32768 }