Skip to content
Snippets Groups Projects
  1. Mar 26, 2021
  2. Mar 22, 2021
  3. Mar 16, 2021
  4. Mar 15, 2021
    • Patrick Cloke's avatar
    • Patrick Cloke's avatar
    • Erik Johnston's avatar
      Don't go into federation catch up mode so easily (#9561) · 026503fa
      Erik Johnston authored
      Federation catch up mode is very inefficient if the number of events
      that the remote server has missed is small, since handling gaps can be
      very expensive, c.f. #9492.
      
      Instead of going into catch up mode whenever we see an error, we instead
      do so only if we've backed off from trying the remote for more than an
      hour (the assumption being that in such a case it is more than a
      transient failure).
      026503fa
    • Richard van der Hoff's avatar
      Optimise missing prev_event handling (#9601) · af2248f8
      Richard van der Hoff authored
      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.
      af2248f8
  5. Mar 12, 2021
  6. Mar 11, 2021
  7. Mar 10, 2021
  8. Mar 09, 2021
Loading