Skip to content
Snippets Groups Projects
Unverified Commit c95b04bb authored by Erik Johnston's avatar Erik Johnston Committed by GitHub
Browse files

Change default `sync_response_cache_duration` (#13042)

parent 7d99414e
No related branches found
No related tags found
No related merge requests found
Set default `sync_response_cache_duration` to two minutes.
...@@ -103,4 +103,10 @@ server_notices: ...@@ -103,4 +103,10 @@ server_notices:
system_mxid_avatar_url: "" system_mxid_avatar_url: ""
room_name: "Server Alert" room_name: "Server Alert"
# Disable sync cache so that initial `/sync` requests are up-to-date.
caches:
sync_response_cache_duration: 0
{% include "shared-orig.yaml.j2" %} {% include "shared-orig.yaml.j2" %}
...@@ -1137,8 +1137,8 @@ Caching can be configured through the following sub-options: ...@@ -1137,8 +1137,8 @@ Caching can be configured through the following sub-options:
* `sync_response_cache_duration`: Controls how long the results of a /sync request are * `sync_response_cache_duration`: Controls how long the results of a /sync request are
cached for after a successful response is returned. A higher duration can help clients cached for after a successful response is returned. A higher duration can help clients
with intermittent connections, at the cost of higher memory usage. with intermittent connections, at the cost of higher memory usage.
By default, this is zero, which means that sync responses are not cached A value of zero means that sync responses are not cached.
at all. Defaults to 2m.
* `cache_autotuning` and its sub-options `max_cache_memory_usage`, `target_cache_memory_usage`, and * `cache_autotuning` and its sub-options `max_cache_memory_usage`, `target_cache_memory_usage`, and
`min_cache_ttl` work in conjunction with each other to maintain a balance between cache memory `min_cache_ttl` work in conjunction with each other to maintain a balance between cache memory
usage and cache entry availability. You must be using [jemalloc](https://github.com/matrix-org/synapse#help-synapse-is-slow-and-eats-all-my-ramcpu) usage and cache entry availability. You must be using [jemalloc](https://github.com/matrix-org/synapse#help-synapse-is-slow-and-eats-all-my-ramcpu)
......
...@@ -206,7 +206,7 @@ class CacheConfig(Config): ...@@ -206,7 +206,7 @@ class CacheConfig(Config):
self.cache_autotuning["min_cache_ttl"] = self.parse_duration(min_cache_ttl) self.cache_autotuning["min_cache_ttl"] = self.parse_duration(min_cache_ttl)
self.sync_response_cache_duration = self.parse_duration( self.sync_response_cache_duration = self.parse_duration(
cache_config.get("sync_response_cache_duration", 0) cache_config.get("sync_response_cache_duration", "2m")
) )
def resize_all_caches(self) -> None: def resize_all_caches(self) -> None:
......
...@@ -169,7 +169,7 @@ def default_config(name, parse=False): ...@@ -169,7 +169,7 @@ def default_config(name, parse=False):
# disable user directory updates, because they get done in the # disable user directory updates, because they get done in the
# background, which upsets the test runner. # background, which upsets the test runner.
"update_user_directory": False, "update_user_directory": False,
"caches": {"global_factor": 1}, "caches": {"global_factor": 1, "sync_response_cache_duration": 0},
"listeners": [{"port": 0, "type": "http"}], "listeners": [{"port": 0, "type": "http"}],
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment