Skip to content
Snippets Groups Projects
  1. Jul 28, 2020
  2. Jul 27, 2020
  3. Jul 24, 2020
  4. Jul 23, 2020
    • Patrick Cloke's avatar
    • Patrick Cloke's avatar
      83434df3
    • Richard van der Hoff's avatar
      Put a cache on `/state_ids` (#7931) · 70788669
      Richard van der Hoff authored
      If we send out an event which refers to `prev_events` which other servers in
      the federation are missing, then (after a round or two of backfill attempts),
      they will end up asking us for `/state_ids` at a particular point in the DAG.
      
      As per https://github.com/matrix-org/synapse/issues/7893, this is quite
      expensive, and we tend to see lots of very similar requests around the same
      time.
      
      We can therefore handle this much more efficiently by using a cache, which (a)
      ensures that if we see the same request from multiple servers (or even the same
      server, multiple times), then they share the result, and (b) any other servers
      that miss the initial excitement can also benefit from the work.
      
      [It's interesting to note that `/state` has a cache for exactly this
      reason. `/state` is now essentially unused and replaced with `/state_ids`, but
      evidently when we replaced it we forgot to add a cache to the new endpoint.]
      70788669
    • Richard van der Hoff's avatar
      Abort federation requests if the client disconnects early (#7930) · 4876af06
      Richard van der Hoff authored
      For inbound federation requests, if a given remote server makes too many
      requests at once, we start stacking them up rather than processing them
      immediatedly.
      
      However, that means that there is a fair chance that the requesting server will
      disconnect before we start processing the request. In that case, if it was a
      read-only request (ie, a GET request), there is absolutely no point in
      building a response (and some requests are quite expensive to handle).
      
      Even in the case of a POST request, one of two things will happen:
      
       * Most likely, the requesting server will retry the request and we'll get the
         information anyway.
      
       * Even if it doesn't, the requesting server has to assume that we didn't get
         the memo, and act accordingly.
      
      In short, we're better off aborting the request at this point rather than
      ploughing on with what might be a quite expensive request.
      4876af06
    • Michael Kaye's avatar
      ff22672f
    • Patrick Cloke's avatar
  5. Jul 22, 2020
Loading