Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch changes the backfill tolerance pattern, which is used to prevent preliminary real-time data from being cached until it is old enough to be considered final, from an eager load to a lazy load pattern.
The previous implementation would simply not cache data new enough to fall in the backfill tolerance window. As a result, every single real-time request to Trickster for the given Backend would result in a partial cache hit at best, since some data would always be excluded from the cache and need to be fetched. There was no possibility of a Cache Hit for time series requests on backends with a backfill tolerance set.
The new approach improves the methodology by caching the the preliminary data and serving to subsequent requests, so long as the lookup is otherwise a cache hit. once a request is made that has a cache status of partial hit - meaning some data requested by the client, but in a different time range than the preliminary data, needs to be fetched - then the resulting delta proxy request will also include any preliminary data ranges that were part of the client range, so as to refresh them.
In this way, preliminary real-time data are eventually updated to their final values, so long as subsequent real-time requests continue to come through to create qualifying partial hits. This allows backends with backfill tolerance to have a Cache Hit Rate comparable to Backends without a backfill tolerance set, while ensuring preliminary data still gets updated.
Separately, a new option was added called
BackfillTolerancePoints
(in addition to the existingBackfillToleranceMS
). The new option will calculate an alternate backfill tolerance ofBackfillTolerancePoints * request.StepValue
, and the delta proxy cache will choose whichever tolerance value is greater, based on the query's step value. This way, no matter if a chart is a 1yr look with 1wk steps, or 10m look with a 5s step, backfill tolerance will work proportionately.