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

Events with lots of prev_events make backfill very slow #13677

Open
richvdh opened this issue Aug 30, 2022 · 1 comment
Open

Events with lots of prev_events make backfill very slow #13677

richvdh opened this issue Aug 30, 2022 · 1 comment
Labels
A-Federation A-Messages-Endpoint /messages client API endpoint (`RoomMessageListRestServlet`) (which also triggers /backfill) A-Performance Performance, both client-facing and admin-facing O-Occasional Affects or can be seen by some users regularly or most users rarely S-Major Major functionality / product severely impaired, no satisfactory workaround. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@richvdh
Copy link
Member

richvdh commented Aug 30, 2022

I tried to do a backfill in Matrix HQ, and as part as the received events, I received $k59mE1_NBJs-JP4QTza2N7VMahvLp_GlvoYLcJ821s8. This event has 20 prev_events, almost none of which I have in my db.

For each of those 20 events, we then request the full state of the room (taking 24 seconds), and then have to request a lot more individual events for the state or auth_chain. Many of those events get requested each time, because their signing keys have expired, or have been invalidated, so it is impossible to find a good copy of the event (see #13676). This whole process takes at least a minute for each of the 19 missing prev_events.

The whole /messages request took 1787 seconds (nearly 30 minutes).

@richvdh richvdh added A-Federation A-Performance Performance, both client-facing and admin-facing S-Major Major functionality / product severely impaired, no satisfactory workaround. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. O-Occasional Affects or can be seen by some users regularly or most users rarely labels Aug 30, 2022
@MadLittleMods MadLittleMods added the A-Messages-Endpoint /messages client API endpoint (`RoomMessageListRestServlet`) (which also triggers /backfill) label Aug 30, 2022
@MadLittleMods
Copy link
Contributor

MadLittleMods commented May 23, 2023

Another culprit is the org.matrix.dummy_event's which Synapse automatically puts in the DAG to resolve outstanding/dangling forward extremities when there are more than 5 in the room. Since they have many disparate prev_events, it takes forever to get the state for each prev_event and persist.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Federation A-Messages-Endpoint /messages client API endpoint (`RoomMessageListRestServlet`) (which also triggers /backfill) A-Performance Performance, both client-facing and admin-facing O-Occasional Affects or can be seen by some users regularly or most users rarely S-Major Major functionality / product severely impaired, no satisfactory workaround. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

No branches or pull requests

2 participants