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

Initial /sync when filtered to a single room can be very slow #10842

Open
squahtx opened this issue Sep 17, 2021 · 3 comments
Open

Initial /sync when filtered to a single room can be very slow #10842

squahtx opened this issue Sep 17, 2021 · 3 comments
Labels
P3 (OBSOLETE: use S- labels.) Approved backlog: not yet scheduled, will accept patches S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@squahtx
Copy link
Contributor

squahtx commented Sep 17, 2021

Description

The /rooms/{roomId}/initialSync endpoint is deprecated and the documentation suggests using /sync instead.

However, using /sync with a room filter has drastically worse performance for users in very many rooms,
eg. taking up to 400 seconds for a user in 2,200 rooms and pulling 100,000+ events from the database.

Steps to reproduce

GET /_matrix/client/r0/sync?filter=%7B%22room%22:+%7B%22rooms%22:+%5B%22!XXXXXXXXXXXXXXXXXX:matrix.org%22%5D,+%22state%22:+%7B%22rooms%22:+%5B%22!XXXXXXXXXXXXXXXXXX:matrix.org%22%5D%7D,+%22timeline%22:+%7B%22rooms%22:+%5B%22!XXXXXXXXXXXXXXXXXX:matrix.org%22%5D,+%22senders%22:+%5B%22@xxxxxxxxxx:matrix.org%22%5D%7D,+%22ephemeral%22:+%7B%22limit%22:+0,+%22types%22:+%5B%5D%7D,+%22account_data%22:+%7B%22limit%22:+0,+%22types%22:+%5B%5D%7D%7D,+%22presence%22:+%7B%22limit%22:+0,+%22types%22:+%5B%5D%7D,+%22account_data%22:+%7B%22limit%22:+0,+%22types%22:+%5B%5D%7D%7D

Version information

  • Homeserver: matrix.org
Gnuxie added a commit to matrix-org/mjolnir that referenced this issue Sep 17, 2021
See matrix-org/synapse#10842.
For the time being this seems to be the only way to avoid requests
that take several minutes for synapse to complete and timeout.
Gnuxie added a commit to matrix-org/mjolnir that referenced this issue Sep 17, 2021
Use `rooms/initialSync` instead of `sync` to fetch room history. See matrix-org/synapse#10842.
@DMRobertson DMRobertson added P3 (OBSOLETE: use S- labels.) Approved backlog: not yet scheduled, will accept patches S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. X-Needs-Discussion labels Sep 17, 2021
@ShadowJonathan
Copy link
Contributor

Sync v3 looks to be addressing this, by adding filters and scoped syncing. Though my knowledge of the draft stops beyond that point.

Maybe this could be good feedback on the sync-v3 efforts then, though.

@reivilibre
Copy link
Contributor

I believe this is just an implementation detail that /initialSync is optimised better than this for /sync and don't think it's specific to sync v2

@clokep
Copy link
Member

clokep commented Jan 6, 2023

Note that the filter given in the first comment is:

{
  "room": {
    "rooms": [
      "!XXXXXXXXXXXXXXXXXX:matrix.org"
    ],
    "state": {
      "rooms": [
        "!XXXXXXXXXXXXXXXXXX:matrix.org"
      ]
    },
    "timeline": {
      "rooms": [
        "!XXXXXXXXXXXXXXXXXX:matrix.org"
      ],
      "senders": [
        "@xxxxxxxxxx:matrix.org"
      ]
    },
    "ephemeral": {
      "limit": 0,
      "types": []
    },
    "account_data": {
      "limit": 0,
      "types": []
    }
  },
  "presence": {
    "limit": 0,
    "types": []
  },
  "account_data": {
    "limit": 0,
    "types": []
  }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 (OBSOLETE: use S- labels.) Approved backlog: not yet scheduled, will accept patches S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

No branches or pull requests

6 participants