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

querier: adjust requested limit parameter for downstream requests to series endpoint #10652

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

narqo
Copy link
Contributor

@narqo narqo commented Feb 14, 2025

What this PR does

This is a follow-up to #10620

Here I'm updating the MetricsForLabelMatchers to adjust the limit parameter passed to the downstream ingesters, base on the replication sets. The idea, suggested by @pracucci is to approximate the limit as:

L / (<shard-size> / <replication-factor>)

Note that for ingest storage, the above formula is equivalent to L / <partition-shard-size>.

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

@narqo narqo changed the title distributor: adjust requested limit parameter for downstream requests for series endpoint querier: adjust requested limit parameter for downstream requests for series endpoint Feb 14, 2025
@narqo narqo force-pushed the vldmr/series-api-limit branch from b17685e to 4d7ffd2 Compare February 14, 2025 19:56
@narqo narqo changed the title querier: adjust requested limit parameter for downstream requests for series endpoint querier: adjust requested limit parameter for downstream requests to series endpoint Feb 14, 2025
pkg/distributor/distributor.go Outdated Show resolved Hide resolved
if d.cfg.IngestStorageConfig.Enabled {
// When ingest storage is enabled, each partition, represented by one replication set is owned by only one ingester.
// So we use the number of replication sets to count the number of shards.
shardSize = len(replicationSets)
Copy link
Collaborator

Choose a reason for hiding this comment

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

len(replicationSets) includes both ACTIVE and INACTIVE partitions. To be more accurate, I think we should only consider ACTIVE partitions (the shard size on the write path, where series are written, is made only of ACTIVE partitions). It may not be a big deal: if we decide to not address it, then I would at least leave a comment here about it.

} else if len(replicationSets) == 1 {
// We expect to always have exactly 1 replication set when ingest storage is disabled.
// In classic Mimir the total number of shards (ingestion-tenant-shard-size) is the number of ingesters in the shard across all zones.
shardSize = len(replicationSets[0].Instances) / d.ingestersRing.ReplicationFactor()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar comment about read-only instances here. Another case where the number of instances is higher than the real shard size is when the "lookback" threshold triggers (e.g. for 12h after a scale up). The number of instances we lookup is higher than the real shard size. I think what we really want here is the shard size as computed on the write path, and not the read path. It would be more accurate computing the actual shard size by looking at the min between "configured tenant shard size" and "writeable instances/partitions in the ring".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the PR. The idea makes sense to me, although I'm not fully sure whether I've picked the right methods in the ring to calculate what you'd suggested. PTAL

Signed-off-by: Vladimir Varankin <[email protected]>
Signed-off-by: Vladimir Varankin <[email protected]>
Signed-off-by: Vladimir Varankin <[email protected]>
@narqo narqo marked this pull request as ready for review February 17, 2025 20:28
@narqo narqo requested a review from a team as a code owner February 17, 2025 20:28
@narqo narqo requested a review from pracucci February 17, 2025 20:28
Signed-off-by: Vladimir Varankin <[email protected]>
@narqo narqo force-pushed the vldmr/series-api-limit branch from 8ae53eb to 4bfdff4 Compare February 17, 2025 20:33
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