-
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
Fix Series API slowness #2123
Fix Series API slowness #2123
Conversation
This is just an attempt to fix the API slowness. I may be wrong |
Codecov Report
@@ Coverage Diff @@
## master #2123 +/- ##
==========================================
+ Coverage 61.50% 61.79% +0.28%
==========================================
Files 149 149
Lines 11935 12084 +149
==========================================
+ Hits 7341 7467 +126
- Misses 4012 4029 +17
- Partials 582 588 +6
|
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.
I think we want to solve it this way #2106 instead.
The problem with the current approach is that you may load a lot of chunks in memory that can cause the querier to OOM. Currently it's limited by s.cfg.MaxChunkBatchSize
which is 50 at the time.
I'll defer to Owen, but I think we want instead to split queries by time.
Got your point. I didn't realize this |
Oh yes, I'd much rather we solve this via parallelization in the frontend the same way we do for other queries. Would you like to pick up that approach instead? |
da64194
to
7a1e827
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.
This is looking good. I left a couple of comments to address and I'd also appreciate some tests in
codec_test.go
covering encoding/decoding as well as split_by_interval_test.go
specifically in the Test_splitByInterval_Do
and Test_splitQuery
table tests.
5357012
to
f7187ec
Compare
end := start.Add(interval) | ||
if end.After(r.EndTs) { | ||
end = r.EndTs | ||
for start := req.GetStart(); start < req.GetEnd(); start = start + interval.Milliseconds() { |
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.
This change limits us to use only millisecond
. Since, GetStart
and GetEnd
methods converts the time to milliseconds
we won't able to measure anything below millisecond
Time with value 1575892860000000001
will be 1575892860000
upon calling GetStart
or GetEnd
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.
Great point, I didn't think of that.
I think your original approach is better :)
@owen-d Have made the changes based on your comments. Kindly review. |
pkg/querier/queryrange/codec_test.go
Outdated
@@ -168,6 +184,35 @@ func Test_codec_EncodeRequest(t *testing.T) { | |||
require.Equal(t, "/loki/api/v1/query_range", req.(*LokiRequest).Path) | |||
} | |||
|
|||
func Test_codec_sereis_EncodeRequest(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.
func Test_codec_sereis_EncodeRequest(t *testing.T) { | |
func Test_codec_series_EncodeRequest(t *testing.T) { |
Thanks for addressing my comments; it looks great. Just a bit of cleanup then we can get this merged |
f7187ec
to
bb5fcf7
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.
Great thanks!
What this PR does / why we need it:
Fix Series API slowness
Which issue(s) this PR fixes:
Fixes #2121
Checklist