-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
store: add downloaded bytes limit #5801
store: add downloaded bytes limit #5801
Conversation
Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
c973e01
to
9382158
Compare
We always expect an error here. Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
9382158
to
29b449e
Compare
@GiedriusS do we already have a metric with the size of the postings being fetched? Without having access to this information the limit's value can only be set based on guesses instead of needs. |
pkg/store/bucket.go
Outdated
@@ -2132,6 +2159,17 @@ func (r *bucketIndexReader) fetchPostings(ctx context.Context, keys []labels.Lab | |||
return uint64(ptrs[i].ptr.Start), uint64(ptrs[i].ptr.End) | |||
}) | |||
|
|||
if bytesLimiter != nil { |
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 about having a nopLimiter
to avoid nil checks?
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 thought it would be cleaner to add checks instead of passing NewBytesLimiterFactory(0)(nil)
everywhere 😄 let me do this change
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.
If we make the bytesLimiter an interface, then we don't need to pass the factory around right?
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.
But it is an interface already, no? I don't get your point. A nopLimiter
is the same as NewBytesLimiterFactory(0)()
so I'm not sure what is the benefit of having nopLimiter
. Problem is that you have to pass some kind of limiter in all places in all tests even though it is irrelevant. The purpose of this if
is to avoid having to copy/paste that. Whether it is nopLimiter
or NewBytesLimiterFactory(0)()
it doesn't matter. Either way, let me make this change
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.
Thought of a better idea - since it will be pretty much necessary to pass something here, I've made it into a "normal" argument to NewBucketStore
. With this, it won't be needed to add a bunch of if
s everywhere.
One could take a look at |
@GiedriusS gotcha. I think there is value in upstreaming vinted@7ca3496 indeed. It would help a lot in setting values for the size of the postings fetched. <3 |
…limit Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
ca34d36
to
59de426
Compare
CircleCI is broken for some reason 😢 |
I have no idea what this is. 🤯 |
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.
lgtm 👍
Looks like the tests might be flaky? https://github.com/thanos-io/thanos/actions/runs/3344323501/jobs/5538543830#step:5:1879 |
Thanks for the report, I will try to look into that as soon as possible. |
* store: add downloaded bytes limit Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com> * store: add bytesLimiter to LabelNames, LabelValues Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com> * test: add e2e test for new limiter Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com> * *: update CHANGELOG/etc Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com> * e2e: hard fail on no error We always expect an error here. Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com> * CHANGELOG: fix & improve clarity Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com> Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
* store: add downloaded bytes limit Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com> * store: add bytesLimiter to LabelNames, LabelValues Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com> * test: add e2e test for new limiter Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com> * *: update CHANGELOG/etc Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com> * e2e: hard fail on no error We always expect an error here. Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com> * CHANGELOG: fix & improve clarity Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com> Signed-off-by: Giedrius Statkevičius <giedrius.statkevicius@vinted.com>
Changes
Adds the ability to limit downloaded bytes in Thanos Store for LabelNames/LabelValues/Series. This is needed to make capacity planning easier and because current limits aren't that effective since to calculate series/chunks limit, we first need to download all matching postings.
Closes #5733.
Verification
E2E tests.