-
Notifications
You must be signed in to change notification settings - Fork 476
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-gateway: series streaming #3348
Comments
I think we can close this issue and move remaining work to other issues the remaining work for this is
We have discussed internally that this is tricky and will probably involve more work. I'm also not sure if we want to do this given the improvements in memory profiles. I'm tempted to not create an issue because it's not addressing any serious problem in the store-gateway at the moment. @pracucci do you agree?
We may do this as part of implementing memory quotas. If I create an issue for that, I will include this there.
this has an issue and I will try to work on it when I have bandwidth. But I also think it has enough details for someone else to work on it.
I think it's possible to introduce sub packages: I think doing this with the help of an IDE may not be terribly difficult, but it will touch the majority of lines in the pkg/storegateway. Do you have an opinion on this Marco?
Along with #3939 I will try to try this out too. I've opened an issue #4984, and maybe someone else can pitch in with experience. |
closing as all follow-up items are already in issues |
Background
The current implementation of the store-gateway's
Series()
gRPC method fetches all data for each block concurrently and holds them in memory until responding to the method. This leads to increased memory usage. We also cannot control the amount of memory the store-gateway uses, so with many heavy requests simultaneously a store-gateway can go out of memory.Proposal
The proposal is to fetch the index header (symbols, chunk refs) and chunks contents in batches. This way we can control the amount of memory we use at a time. By reusing the memory for each batch we also ensure a constant memory usage for each request.
It comes with the tradeoff of having to do multiple requests to the cache and to the object store. We can deal with this by having a relatively large size of each batch. This way only big
Series()
calls will require multiple requests.Further improvements
Provide constant memory usage for all inflight requests instead of for each request. This will secure the store-gateway from going out of memory.
Add strategies for dealing with incoming requests when at capacity
TODO
Week of:
Nov 21
Nov 28
add specific tests for streaming-based implementation
BatchSet
s andSeriesSet
s implementationsstart merging design into
main
deploy streaming store-gateway alongside old code in one cluster
Dec 5
Dec 12
Dec 19
Jan 2
Jan 16
Jan 23
Unprioritized TODOs
Features:
Optimizations:
Fetch postings asynchronously in(concurrency will likely increase memory usage which is against the goal of this projectopenBlockSeriesChunkRefsSetsIterator
; otherwise we wait on fetching postings from the slowest block before starting to load series, merge them and load chunksmetasToChunks()
: during load testing with "few large requests", memory allocated bymetasToChunks()
accounted for about 7%. Can we optimise it?(low impact, this hasn't shown up in profiles since)bucketChunkReader.addLoad()
: during load testing with "few large requests", memory allocated bybucketChunkReader.addLoad()
accounted for about 4%. I suspect there's a lot of reslicing, because chunks are added 1-by-1 to the reader.add pooling for snappy decoding buffers - see this comment store-gateway: more efficient series caching #3751 (comment)(this turned out to be low impact)Tests:
gateway_test.go
run with streaming and without streaming implementation Enable streaming store-gateway by default #4330Code design:
seriesChunk
is repeated 702 times in/pkg/storegateway
)seriesChunkRefs
withindex
(indexSet
,indexSetIterator
) andseriesChunks
withcompleteSeries
(completeSeriesSet
,completeSeriesIterator
)deduplicatingSeriesChunkRefsSetIterator
->deduplicatingIterator
)Configuration:
-blocks-storage.bucket-store.batch-series-size
and set it to a sensible value (we're running with 5000 so far) store-gateway: experiment with different batch sizes for series streaming #4984-blocks-storage.bucket-store.max-concurrent
after quota manager is merged because concurrency will be determined by the amount of free resourcesLow priority (will be trivial once we stop supporting non-streaming version)
seriesEntry
toseriesChunks
#4747The text was updated successfully, but these errors were encountered: