-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Allow configuration of Synapse's cache without using synctl or environment variables #6391
Conversation
…environment variables.
7f59798
to
a14831d
Compare
synapse/http/client.py
Outdated
@@ -241,7 +240,8 @@ def __getattr__(_self, attr): | |||
# tends to do so in batches, so we need to allow the pool to keep | |||
# lots of idle connections around. | |||
pool = HTTPConnectionPool(self.reactor) | |||
pool.maxPersistentPerHost = max((100 * CACHE_SIZE_FACTOR, 5)) | |||
# XXX: Why does this use the cache factor???? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was just a handy way of making it scale for larger instances. The logic went that if you're running a larger instance, you'll bump your cache factor, and will probably want a bigger connection pool too. it's a bit of a hack, but otoh I didn't want to have millions of options that you have to tune.
self._state_group_members_cache = DictionaryCache( | ||
"*stateGroupMembersCache*", | ||
500000 * get_cache_factor_for("stateGroupMembersCache"), | ||
"*stateGroupMembersCache*", 500000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this no longer have a cache factor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because now DictionaryCache does the cache factor math, not the things that call it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm not following where its doing that? AFAICT get_cache_factor_for
is only called for a single cache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, but now you can configure any of the cache sizes, so it's done in the caches itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry I'm still banging on about sample config.
docs/sample_config.yaml
Outdated
# Controls the global cache factor. This overrides the "SYNAPSE_CACHE_FACTOR" | ||
# environment variable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please can you explain what a global cache factor is, and document the default setting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've attempted to do so.
docs/sample_config.yaml
Outdated
@@ -1973,3 +1973,20 @@ opentracing: | |||
# | |||
# logging: | |||
# false | |||
|
|||
|
|||
## Cache Configuration ## |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised the very end of the file is the most appropriate place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved it much further up, near the database config. What do you think?
…cache-config-without-synctl
…cache-config-without-synctl
…cache-config-without-synctl * 'develop' of github.com:matrix-org/synapse: (43 commits) Remove unused store method get_hosts_in_room (#7448) Don't UPGRADE database rows RST indenting Put rollback instructions in upgrade notes Fix changelog typo Oh yeah, RST Absolute URL it is then Fix upgrade notes link Provide summary of upgrade issues in changelog. Fix ) Move next version notes from changelog to upgrade notes Changelog fixes 1.13.0rc1 Documentation on setting up redis (#7446) Rework UI Auth session validation for registration (#7455) Extend spam checker to allow for multiple modules (#7435) Implement OpenID Connect-based login (#7256) Add room details admin endpoint (#7317) Fix errors from malformed log line (#7454) Drop support for redis.dbid (#7450) Fixes typo (bellow -> below) (#7449) ...
…nment variables (#6391)
…nment variables (#6391)
This mostly applise to `*stateGroupCache*` and co. Broke in #6391.
This mostly applise to `*stateGroupCache*` and co. Broke in #6391.
…#7580) This mostly applise to `*stateGroupCache*` and co. Broke in matrix-org#6391.
This is useful in docker environments, where you have the ability to easily change config files, not not always env vars. It also makes it not a weird odd-one-out as far as configuring your Synapse install.