Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Improve performance of /sync when the filter specifies no room IDs #14784

Description

@kegsay

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

Activity

  1. clokep commented on Jan 6, 2023

    @clokep
    Member

    @kegsay I don't think filtering with an empty array does anything, see matrix-org/matrix-spec#1312. You could try a filter of { room: { not_rooms: ["*"] } } which I think will be slightly better, but will still do some processing over rooms.

  2. changed the title [-]Improve performance of /sync when the filter specifies room IDs[/-] [+]Improve performance of /sync when the filter specifies no room IDs[/+] on Jan 6, 2023
  3. self-assigned this
    on Jan 6, 2023
  4. clokep commented on Jan 10, 2023

    @clokep
    Member

    #14786 did help here, but...skipped properly calculating changed devices. I'm going to re-open this and back-out the broken bits (#14810).

  5. reopened this on Jan 10, 2023
  6. removed their assignment
    on Jan 11, 2023
  7. added
    A-Syncdefects related to /sync
    S-MinorBlocks non-critical functionality, workarounds exist.
    T-EnhancementNew features, changes in functionality, improvements in performance, or user-facing enhancements.
    O-UncommonMost users are unlikely to come across this or unexpected workflow
    on Jan 11, 2023
  8. linked a pull request that will close this issueSkip unused calculations in sync handler #14908on Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-Syncdefects related to /syncO-UncommonMost users are unlikely to come across this or unexpected workflowS-MinorBlocks non-critical functionality, workarounds exist.T-EnhancementNew features, changes in functionality, improvements in performance, or user-facing enhancements.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions