perf: Add benchmarks for timeseries query (exemplars) performance #4665
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.
Adds benchmarks to measure and validate the performance of timeseries queries, particularly focusing on the exemplar collection overhead introduced in #4615.
Performance Results
Part 1: Refactoring Cost (NoExemplars vs weekly/f145)
We refactored
profileEntryIteratorto use a flexible options pattern. This section measures the cost of that refactoring even when exemplars are disabled.Comparison Setup:
weekly/f145branch (old simple implementation, before exemplar PR)NoExemplars(new options pattern, exemplars disabled)Commands Used:
Analysis:
Potential memory trade-off explanation:
The refactored
profileEntryIteratoruses a flexible options pattern with:Part 2: Exemplar Feature Overhead (NoExemplars vs WithExemplars)
This section measures the additional cost of enabling exemplars on top of the refactored baseline.
Command Used:
Analysis:
Overhead explanation:
When exemplars are enabled, additional data must be fetched:
The allocation increase comes primarily from fetching full label sets and processing profile IDs for each matching profile.
Overhead consistency across time ranges:
Overhead remains consistent:
Summary
Changes to default path (NoExemplars)
Exemplar overhead
Key findings
Note: Exemplars feature will be opt-in. Users who don't request exemplars are unaffected by the time and allocation overhead. The overhead is inherent to fetching additional data (profile IDs and complete label sets), but future optimizations could reduce the impact if needed.