-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Avoid /backfill when we already have enough messages to return for a /messages response #15696
Description
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!
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.
