forked-synapse/changelog.d
Richard van der Hoff af2248f8bf
Optimise missing prev_event handling (#9601)
Background: When we receive incoming federation traffic, and notice that we are missing prev_events from 
the incoming traffic, first we do a `/get_missing_events` request, and then if we still have missing prev_events,
we set up new backwards-extremities. To do that, we need to make a `/state_ids` request to ask the remote
server for the state at those prev_events, and then we may need to then ask the remote server for any events
in that state which we don't already have, as well as the auth events for those missing state events, so that we
can auth them.

This PR attempts to optimise the processing of that state request. The `state_ids` API returns a list of the state
events, as well as a list of all the auth events for *all* of those state events. The optimisation comes from the
observation that we are currently loading all of those auth events into memory at the start of the operation, but
we almost certainly aren't going to need *all* of the auth events. Rather, we can check that we have them, and
leave the actual load into memory for later. (Ideally the federation API would tell us which auth events we're
actually going to need, but it doesn't.)

The effect of this is to reduce the number of events that I need to load for an event in Matrix HQ from about
60000 to about 22000, which means it can stay in my in-memory cache, whereas previously the sheer number
of events meant that all 60K events had to be loaded from db for each request, due to the amount of cache
churn. (NB I've already tripled the size of the cache from its default of 10K).

Unfortunately I've ended up basically C&Ping `_get_state_for_room` and `_get_events_from_store_or_dest` into
a new method, because `_get_state_for_room` is also called during backfill, which expects the auth events to be
returned, so the same tricks don't work. That said, I don't really know why that codepath is completely different
(ultimately we're doing the same thing in setting up a new backwards extremity) so I've left a TODO suggesting
that we clean it up.
2021-03-15 13:51:02 +00:00
..
.gitignore Correct attrs package name in requirements (#3492) 2018-07-07 10:46:59 +10:00
9458.misc Add ResponseCache tests. (#9458) 2021-03-08 14:00:07 -05:00
9473.bugfix Handle image transparency better when thumbnailing. (#9473) 2021-03-09 07:37:09 -05:00
9508.doc Update reverse proxy to add OpenBSD relayd example configuration. (#9508) 2021-03-06 11:49:19 +00:00
9510.feature Record the SSO Auth Provider in the login token (#9510) 2021-03-04 14:44:22 +00:00
9511.feature Prometheus metrics for logins and registrations (#9511) 2021-03-04 16:39:27 +00:00
9520.misc Add type hints to purge room and server notice admin API. (#9520) 2021-03-08 10:34:38 -05:00
9523.misc Add logging to ObservableDeferred callbacks (#9523) 2021-03-09 11:09:31 +00:00
9528.misc Create a SynapseReactor type which incorporates the necessary reactor interfaces. (#9528) 2021-03-08 08:25:43 -05:00
9540.feature Replace last_*_pdu_age metrics with timestamps (#9540) 2021-03-04 16:40:18 +00:00
9540.removal Replace last_*_pdu_age metrics with timestamps (#9540) 2021-03-04 16:40:18 +00:00
9541.misc Add a basic test for purging rooms. (#9541) 2021-03-08 09:21:36 -05:00
9542.bugfix Add a background task to purge unused chain IDs. (#9542) 2021-03-09 11:22:25 -05:00
9543.misc Fix additional type hints. (#9543) 2021-03-09 07:41:32 -05:00
9549.feature JWT OIDC secrets for Sign in with Apple (#9549) 2021-03-09 15:03:37 +00:00
9550.doc Add additional SAML2 upgrade notes (#9550) 2021-03-05 12:07:50 +00:00
9559.removal Warn that /register will soon require a type when called with an access token (#9559) 2021-03-08 16:35:04 +00:00
9560.misc Add a list of hashes to ignore during git blame. (#9560) 2021-03-09 07:34:55 -05:00
9562.misc Prevent the config-lint script erroring out on any sample_config changes (#9562) 2021-03-09 11:11:42 +00:00
9563.misc Add tests for blacklisting reactor/agent. (#9563) 2021-03-11 09:15:22 -05:00
9567.bugfix Retry 5xx errors in federation client (#9567) 2021-03-09 13:15:12 +00:00
9568.misc Do not ignore the unpaddedbase64 module when type checking. (#9568) 2021-03-09 14:41:02 -05:00
9571.doc Link to the List user's media admin API from media Admin API docs (#9571) 2021-03-09 15:15:52 +00:00
9573.feature Fix the auth provider on the logins metric (#9573) 2021-03-10 18:15:03 +00:00
9576.misc Use the chain cover index in get_auth_chain_ids. (#9576) 2021-03-10 09:57:59 -05:00
9580.doc Fix spam checker modules documentation example (#9580) 2021-03-10 10:42:51 -05:00
9583.bugfix Fix a bug in the background task for purging chain cover. (#9583) 2021-03-10 08:55:52 -05:00
9586.misc Convert Requester to attrs (#9586) 2021-03-10 18:15:56 +00:00
9587.bugfix Re-Activating account when local passwords are disabled (#9587) 2021-03-11 13:52:32 +00:00
9590.misc Add logging for redis connection setup (#9590) 2021-03-11 18:35:09 +00:00
9591.misc Fix additional type hints from Twisted 21.2.0. (#9591) 2021-03-12 11:37:57 -05:00
9596.misc Improve logging when processing incoming transactions (#9596) 2021-03-12 15:08:03 +00:00
9597.bugfix Reject concurrent transactions (#9597) 2021-03-12 15:14:55 +00:00
9601.feature Optimise missing prev_event handling (#9601) 2021-03-15 13:51:02 +00:00