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

Avoid /backfill when we already have enough messages to return for a /messages response #15696

@MadLittleMods

Description

@MadLittleMods

Avoid /backfill when we already have enough messages to return for a /messages response

As you can see from the trace, if we were somehow smart enough to know not to /backfill, we would save ourselves 14s from that 16.42s request. In this example, there is only a single new event out of the 100 returned in the /backfill response that is "new" to us and it's one that already has failed pull attempts so we end up skipping it anyway because of expontential backoff. This is definitely a candidate where we didn't need to /backfill!

Full Jaeger trace JSON

Questions

What kind of heuristic can we use to know that we have enough messages to respond to /messages request? In other words, it's fine to have small holes (especially with cases where we've attempted to fill the hole before) but if we're missing a big chunk of history, then we probably should try /backfill.

Perhaps we can look at the depth of the continuous set of messages and if there isn't too big of a gap between them, we can consider it good enough. Maybe potentially still trigger a /backfill in the background so things can become eventually consistent.

Metadata

Metadata

Assignees

Labels

A-FederationA-Messages-Endpoint/messages client API endpoint (`RoomMessageListRestServlet`) (which also triggers /backfill)A-PerformancePerformance, both client-facing and admin-facingO-OccasionalAffects or can be seen by some users regularly or most users rarelyS-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

Relationships

None yet

Development

No branches or pull requests

Issue actions