summary refs log tree commit diff
path: root/synapse/config/server.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-04-28 14:51:31 +0100
committerErik Johnston <erik@matrix.org>2021-04-28 14:51:31 +0100
commit79627b3a3c93b2166de679de0f4e863094e18460 (patch)
treed1a9b03291cf906877ec373df3e824bf3390e058 /synapse/config/server.py
parentMerge remote-tracking branch 'origin/release-v1.33.0' into develop (diff)
downloadsynapse-79627b3a3c93b2166de679de0f4e863094e18460.tar.xz
Limit how often GC happens by time.
Synapse can be quite memory intensive, and unless care is taken to tune
the GC thresholds it can end up thrashing, causing noticable performance
problems for large servers. We fix this by limiting how often we GC a
given generation, regardless of current counts/thresholds.

This does not help with the reverse problem where the thresholds are set
too high, but that should only happen in situations where they've been
manually configured.

Adds a `gc_min_seconds_between` config option to override the defaults.

Fixes #9890.
Diffstat (limited to 'synapse/config/server.py')
-rw-r--r--synapse/config/server.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/synapse/config/server.py b/synapse/config/server.py

index 21ca7b33e3..ca1c9711f8 100644 --- a/synapse/config/server.py +++ b/synapse/config/server.py
@@ -572,6 +572,7 @@ class ServerConfig(Config): _warn_if_webclient_configured(self.listeners) self.gc_thresholds = read_gc_thresholds(config.get("gc_thresholds", None)) + self.gc_seconds = read_gc_thresholds(config.get("gc_min_seconds_between", None)) @attr.s class LimitRemoteRoomsConfig: @@ -917,6 +918,14 @@ class ServerConfig(Config): # #gc_thresholds: [700, 10, 10] + # The minimum time in seconds between each GC for a generation, regardless of + # the GC thresholds. This ensures that we don't do GC too frequently. + # + # A value of `[1, 10, 30]` indicates that a second must pass between consecutive + # generation 0 GCs, etc. + # + # gc_min_seconds_between: [1, 10, 30] + # Set the limit on the returned events in the timeline in the get # and sync operations. The default value is 100. -1 means no upper limit. #