Micro optimization to parallelStorageShards for the case there's only 1 shard #13961
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does
This PR is a follow up of #13924. In this PR I'm doing a micro optimization to
parallelStorageShardsfor the case there's only 1 shard. The impact of this optimization is minimal, but I think doesn't make the code harder to follow, so it may be worth to keep it.My local benchmarks are not super stable, but here you can get an idea of the impact (minimal). Keep in mind
PusherConsumer_ParallelPusher_MultiTenantuses a mocked backend. In the real world, where metrics are actually ingested in TSDB, the impact is much smaller:No changelog because I will add one at the end of this work, once
-ingest-storage.kafka.ingestion-concurrency-sequential-pusher-enabledwill be removed and the new behaviour will be the default. With the default configparallelStorageShardsis never used with only 1 shard (you need to set-ingest-storage.kafka.ingestion-concurrency-sequential-pusher-enabled=falseto useparallelStorageShardseven when there's only 1 shard).Which issue(s) this PR fixes or relates to
N/A
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]. If changelog entry is not needed, please add thechangelog-not-neededlabel to the PR.about-versioning.mdupdated with experimental features.Note
Optimizes shard routing when
numShards == 1and refines performance benchmarks.parallelStorageShards.PushToStorageAndReleaseRequest, bypasses label hashing/modulo and always targets shard0when only one shard; metadata routing now skips round-robin and random start when single-shard.BenchmarkPusherConsumer_ParallelPusher_MultiTenant: replaces single-parameter sweep with nestedrecords×tenantscases, prebuilds records per case, and setsIngestionConcurrencySequentialPusherEnabled=falseto exercise parallel pusher consistently.Written by Cursor Bugbot for commit 49af667. This will update automatically on new commits. Configure here.