From ec838dc4c3d7b67d2a1fa5419f795a3d32c9c3b3 Mon Sep 17 00:00:00 2001 From: Catalan Lover Date: Thu, 17 Aug 2023 19:46:10 +0200 Subject: [PATCH] Modify Synapse Cache Factor to use Auto Tune Synapse has the ability to as it calls in its config auto tune caches. This ability lets us set very high cache factors and then instead limit our resource use. Defaults for this commit are 1/10th of what Element apparently runs for EMS stuff and matrix.org on Cache Factor and upstream documentation defaults for auto tune. --- .../templates/synapse/homeserver.yaml.j2 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 b/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 index b6cc6428b..0fb8adc63 100644 --- a/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 +++ b/roles/custom/matrix-synapse/templates/synapse/homeserver.yaml.j2 @@ -796,13 +796,13 @@ caches: # Controls whether cache entries are evicted after a specified time # period. Defaults to true. Uncomment to disable this feature. # - #expire_caches: false + expire_caches: {{ matrix_synapse_caches_expire_caches }} # If expire_caches is enabled, this flag controls how long an entry can # be in a cache without having been accessed before being evicted. # Defaults to 30m. Uncomment to set a different time to live for cache entries. # - #cache_entry_ttl: 30m + cache_entry_ttl: {{ matrix_synapse_caches_cache_entry_ttl }} # Controls how long the results of a /sync request are cached for after # a successful response is returned. A higher duration can help clients with @@ -811,7 +811,16 @@ caches: # By default, this is zero, which means that sync responses are not cached # at all. # - #sync_response_cache_duration: 2m + sync_response_cache_duration: {{ matrix_synapse_caches_sync_response_cache_duration }} + + #FIX ME add documentation notes about these settings or remove this note. + # Check upstream https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html#caching + # for information for now + # + cache_autotuning: + max_cache_memory_usage: {{ matrix_synapse_caches_autotuning_max_cache_memory_usage }} + target_cache_memory_usage: {{ matrix_synapse_caches_autotuning_target_cache_memory_usage }} + min_cache_ttl: {{ matrix_synapse_caches_autotuning_min_cache_ttl }} ## Database ##