This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
State delta between two events for more efficient delivery and processing #13618
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-Minor
Blocks non-critical functionality, workarounds exist.
T-Enhancement
New features, changes in functionality, improvements in performance, or user-facing enhancements.
Milestone
Spawning from #13356 to make
/messages
faster which includesbackfill
It's very inefficient to have to request the full room state (or
state_ids
) at a given event when we already have the majority of the state locally. For a room like#matrix:matrix.org
,/state_ids
gives 200k events (77k state_events, 122k auth_events) which by its sheer volume takes the sending server a while assemble a response, send it, and then we have process all of it 😱It would be nice if we had an endpoint to get only the state that is different from event A to event B (the delta). This way the sending server doesn't have to send as much and we don't have process as many events to find the couple events that we need.
This new endpoint needs some spec thought and a proper MSC but creating an issue here so we can track the idea before that gets created. One potential option is adding some
from
/to
query parameters to the existing/state_ids
and/state
endpoints.GET /_matrix/federation/v1/state_ids/{roomId}?from_event_id=$a&to_event_id=$b
GET /_matrix/federation/v1/state/{roomId}?from_event_id=$a&to_event_id=$b
It might be good if we could also specify multiple pairs of events to help batch up multiple missing events.
Maybe similar to the existing
/get_missing_events
endpoint where you can specifyearliest_events
andlatest_events
Related issues:
/state_ids
is slow to respond #13620Dev notes
In Synapse, we can use our
state_groups
to to simplify the diff calculation.compute_state_delta
is used for/sync
but is probably of interest as well.(#13586)
synapse/synapse/handlers/federation_event.py
Lines 1035 to 1045 in ec44d79
The text was updated successfully, but these errors were encountered: