Skip to content
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

streaming store-gateway: Polish batchSetsForBlocks #3651

Conversation

dimitarvdimitrov
Copy link
Contributor

  • rename to batchedSeriesSetForBlocks
  • remove unused cleanups
  • move to bucket.go
  • some formatting
  • also remove cleanups from synchronousSeriesSet

@dimitarvdimitrov dimitarvdimitrov requested a review from a team as a code owner December 5, 2022 17:16
* rename to batchedSeriesSetForBlocks
* remove unused cleanups
* move to bucket.go
* some formatting
* also remove cleanups from synchronousSeriesSet

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
@dimitarvdimitrov dimitarvdimitrov force-pushed the dimitar/store-gateway-async-series-move-opening-function branch from f03c20b to f94360e Compare December 5, 2022 17:37
Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

pkg/storegateway/bucket.go Outdated Show resolved Hide resolved
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
@pracucci pracucci merged commit 56a6af6 into dimitar/store-gateway-async-series Dec 6, 2022
@pracucci pracucci deleted the dimitar/store-gateway-async-series-move-opening-function branch December 6, 2022 10:09
dimitarvdimitrov added a commit that referenced this pull request Dec 6, 2022
This is a POC and is not meant to be merged yet.

Overview

Instead of loading all series (label sets and chunks) in memory before
responding to a Series() RPC, we can batch them and load X at a time.
This gives more predictability on the memory utilization of the
store-gateway. The tradeoff is having to do one trip to the index cache
and the bucket for each batch, which will affect overall latency of requests.

How to use

This change disables batch series loading by default and adds two flags
to control this - whether it's enabled via
`-blocks-storage.bucket-store.batched-series-loading=false` and how many
series go into each batch via
`-blocks-storage.bucket-store.batch-series-size=65536`.

Limiting

Ideally we want ot put a limit on the number of bytes that we want to
load in each batch instead of the number of series. For now limiting
the number of series should still give us some resilience against "big"
requests, while still being vulnerable to a flurry of many requests.

Testing

I've changed all tests within pkg/storegateway to use this new loading
strategy. This should give confidence that it is producing correct
results. Further work should improve testing around resource utilization
(i.e. batches are indeed freed one after the other)
and should test both batched and non-batched strategies.

This commit has TODOs, which should be addressed before merging this.

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>

Fix which context we use for openBlockSeriesChunkRefsSetsIterator

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>

Streaming store-gateway: Split up blockSeriesChunkRefsSetIterator (#3641)

Merge main into dimitar/store-gateway-async-series (#3642)

Streaming store-gateway: Move seriesHasher (#3643)

Move test limiter

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>

streaming store-gateway: move and rename loadingBatchSet (#3650)

Renames `loadingBatchSet` to `loadingSeriesChunksSetIterator` and moves
it to `series_chunks.go`

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>

streaming store-gateway: add preloading for series without chunks (#3649)

* streaming store-gateway: add preloading for series without chunks

This PR
* adds preloading to the seriesSet without chunks
* changes the implementation of `preloadingSeriesChunkSetIterator`
to be a generic one, so we can reuse it for preloading
`seriesChunkRefsSet`s too.
* moves some tests of `preloadingSeriesChunkSetIterator` from
`batch_series_test.go` to `series_chunks_test.go`
* moves `newSeriesSetWithChunks` to `series_chunks.go`

Question/note to reviewers: should this iterator be in a new file? I
think putting it in preload.go and tests in preload_test.go sounds ok
since it now applies to both series_chunks.go and series_refs.go.

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>

streaming store-gateway: Polish batchSetsForBlocks (#3651)

* Polish batchSetsForBlocks

* rename to batchedSeriesSetForBlocks
* remove unused cleanups
* move to bucket.go
* some formatting
* also remove cleanups from synchronousSeriesSet

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>

* Rename batchedSeriesSetForBlocks to streamingSeriesSetForBlocks

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Co-authored-by: Marco Pracucci <marco@pracucci.com>

Merge main into dimitar/store-gateway-async-series (#3655)

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants