Skip to content

querier: limit number of blocks queried with one store-gateway request - #16292

Open
narqo wants to merge 5 commits into
mainfrom
vrnkn/querier-max-blocks-per-store-request
Open

querier: limit number of blocks queried with one store-gateway request#16292
narqo wants to merge 5 commits into
mainfrom
vrnkn/querier-max-blocks-per-store-request

Conversation

@narqo

@narqo narqo commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What this PR does

The PR adds a new experimental per-tenant limit, max_blocks_per_store_request (disabled by default), that controls how many blocks a single query can request from one store-gateway instance. If a request spills over the limit, this request is split into multiple partitions, each executed concurrently against the instance.

For detailed rational see #16021

While testing the feature in a dev cell, I saw some improvement, and I believe it should be good for further testing.


Results from dev testing

Before (a request hinted 40 blocks to one store-gw instance)

Screenshot 2026-08-05 at 15 52 36

After (the same request is split into several sub-requests, hinting up to 20 blocks from a store-gw instance)

Screenshot 2026-08-05 at 18 01 34

On the store-gw side in this test, each request was bounded with up to 20 bucketBlock.ensurelndexHeaderLoaded calls per request. The total number of concurrent requests, a store-gw instance accepts is limited by store-gw's global concurrency gate.

Which issue(s) this PR fixes or relates to

Fixes #16021

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

💻 Deploy preview available (Mimir):

Comment thread pkg/querier/blocks_store_queryable.go Outdated
Comment thread pkg/querier/blocks_store_queryable_test.go
Comment thread pkg/querier/blocks_store_replicated_set_test.go Outdated
@narqo
narqo force-pushed the vrnkn/querier-max-blocks-per-store-request branch 3 times, most recently from 62cb6b7 to 23e6bad Compare August 5, 2026 13:07
@narqo
narqo force-pushed the vrnkn/querier-max-blocks-per-store-request branch from 8d47850 to 821ed41 Compare August 6, 2026 09:48
@narqo
narqo marked this pull request as ready for review August 6, 2026 10:59
@narqo
narqo requested review from a team as code owners August 6, 2026 10:59

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 202e176. Configure here.

Comment thread pkg/querier/blocks_store_replicated_set.go
Comment thread pkg/querier/blocks_store_queryable.go
@narqo narqo changed the title querier: limit number of blocks pulled in one request querier: limit number of blocks queried with one store-gateway request Aug 6, 2026
Comment on lines +1058 to +1061
// Concurrently fetch series from all clients. A client may have multiple partitions; each
// partition is one independent RPC to the same store-gateway.
for c, partitions := range clients {
for _, blockIDs := range partitions {

@narqo narqo Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note for the reviewers: the diffs here and below look scarier than what the changes did. We simply wrapped the loop over the list of blocks with a loop over block partitions. The body was just shifted one indentation level.

@JStickler JStickler left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[docs team] Docs LGTM

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.

Limit number of blocks that querier requests from store-gateway replication set

2 participants