Improve performance of /sync when the filter specifies no room IDs #14784
Description
Description
Related: #10842
It would be nice It is critical for Sliding Sync if Synapse checked if the filter JSON was specifying a set of room IDs, and if so just apply /sync to those rooms, which should be significantly faster than a general /sync.
Context: Sliding Sync hits /sync on behalf of users. The first sync is always slow because it needs the data from /sync. However, the first /sync on a 2nd+ device for the same user can be very fast, because the proxy does not wait for the /sync response, it can just serve up the room data fetched from the 1st device. However, to-device messages are per-device and only arrive with the /sync response: I can't do the same trick. In an effort to reduce the /sync time, I specify a filter with room.rooms=[]
which means "no room IDs". This correctly returns no rooms, but it still takes just as long to process.
The end-user impact here is that, whilst Matthew can login to sliding-sync enabled Elements within seconds, it takes 15+ minutes before he can read E2EE messages because to-device messages are delayed.
Steps to reproduce
- Matthew hits /sync with a filter of
{ room: { rooms: [] } }
- Watch it churn for 15mins before returning.
Homeserver
matrix.org
Synapse Version
1.74.0
Installation Method
Other (please mention below)
Database
N/A
Workers
Multiple workers
Platform
N/A
Configuration
N/A
Relevant log output
N/A
Anything else that would be useful to know?
No response