-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
quantile sharding; fix bug related to # of steps (instant query mem usage) and use CollapsingLowestDense store for ddsketch #11905
Conversation
Signed-off-by: Callum Styan <[email protected]>
evaluate more steps than we needed to, especially in the case of instant queries! Signed-off-by: Callum Styan <[email protected]>
dd682ab
to
fbdb52a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find. We altos take the chance and rename the join methods to merge.
pkg/logql/downstream_test.go
Outdated
@@ -181,6 +181,70 @@ func TestMappingEquivalenceSketches(t *testing.T) { | |||
} | |||
} | |||
|
|||
func TestMappingEquivalenceSketches_Instant(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What makes this an instant query? What do you think about song another loop to the original equivalence tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The query params right after this line, in the case of an instant query we set start
and end
to the same value.
@@ -283,6 +283,11 @@ func JoinQuantileSketchVector(next bool, r StepResult, stepEvaluator StepEvaluat | |||
if stepEvaluator.Error() != nil { | |||
return nil, stepEvaluator.Error() | |||
} | |||
// Don't continue to evaluate more steps if we already filled the | |||
// # of steps we should have based on start/end and step params. | |||
if len(result) == stepCount { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How's that done in the original join?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found it
Line 388 in 918e736
if GetRangeType(q.params) == InstantType { |
Signed-off-by: Callum Styan <[email protected]>
Signed-off-by: Callum Styan <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Signed-off-by: Callum Styan <[email protected]>
…sage) and use CollapsingLowestDense store for ddsketch (#11905) Signed-off-by: Callum Styan <[email protected]>
…uery mem usage) and use CollapsingLowestDense store for ddsketch (#11905) Signed-off-by: Callum Styan <[email protected]>
…sage) and use CollapsingLowestDense store for ddsketch (grafana#11905) Signed-off-by: Callum Styan <[email protected]>
EDIT: I also found the bug that was causing us to OOM when executing instant queries, see the 2nd commit
This should reduce the memory allocated by the vector iteration by at least 25% but as much as ~80%. The quantile vector iteration accounts for at least 15% of all in use space last time I tested (and during that time queriers we're OOM'ing as a result of quantile sharding).
However, with the usage of this alternate store type we give up some amount of relative accuracy guarantees for lower quantiles. From their readme:
Benchmark:
And profiling