-
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
[enhancement] querier cache: WriteBackCache should be off query path #5083
Conversation
@cyriltovena review pr please. |
Co-authored-by: Danny Kopping <dannykopping@gmail.com>
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.
Looking better, thank you @liguozhong 👍
A couple more minor comments to resolve and we can merge this.
Co-authored-by: Danny Kopping <dannykopping@gmail.com>
thanks |
Can we add 2 metrics , enqueue total and dequeue total ? The only reason for skipping is that the buffer is full also so I would commit and make the metric name related to it as well as drop the label reason. Love it though thank you for this @liguozhong |
|
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.
Last minor notes from me and then I think we're good to go 👌
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.
Thanks @liguozhong for the PR! I added just a minor nit, but other than that, the changes look great to me, modulo what Danny suggested.
decodeRequests: make(chan decodeRequest), | ||
maxAsyncConcurrency: maxAsyncConcurrency, | ||
maxAsyncBufferSize: maxAsyncBufferSize, | ||
stop: make(chan struct{}, 1), |
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.
You don't need to make this a buffered channel since you are just using it to notify goroutines to stop by closing it.
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.
done,thanks .
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.
There are a few outstanding suggestions, but overall this looks great. Nice work and thanks!
func (c *Fetcher) writeBackCacheAsync(fromStorage []Chunk) error { | ||
select { | ||
case c.asyncQueue <- fromStorage: | ||
chunkFetcherCacheQueueEnqueue.Inc() |
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.
chunkFetcherCacheQueueEnqueue.Add(len(fromStorage))
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.
done,thanks .
for { | ||
select { | ||
case fromStorage := <-c.asyncQueue: | ||
chunkFetcherCacheQueueDequeue.Inc() |
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.
chunkFetcherCacheQueueDequeue.Add(-len(fromStorage))
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.
done,thanks .
Co-authored-by: Danny Kopping <dannykopping@gmail.com>
Awesome contribution @liguozhong ❤️ thanks for being patient with us with the changes requested in the review. |
Signed-off-by: Edward Welch <edward.welch@grafana.com>
Signed-off-by: Edward Welch <edward.welch@grafana.com>
Signed-off-by: Edward Welch <edward.welch@grafana.com>
ref issue: #5072
a queue (buffered channel) configurable in size (500 keys ~ 1GB)
Each chunk is 1Mb, and the chan length is 1000, which is approximately equal to 1Gb