fix(ReplicationTaskFetcher): fix task_fetcher concurrent fetching #7471
+87
−25
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 changed?
Fixed support for parallelizing the replication task fetcher with multiple goroutines and fixed metrics to measure fetch performance.
Metrics:
The fetcher now supports multiple concurrent fetch goroutines (controlled by ReplicationTaskFetcherParallelism config), with shards distributed across goroutines using modulo arithmetic to maintain deterministic routing.
Why?
Parallelization allows the fetcher to handle more shards concurrently without losing the benefits of request batching. The new metrics provide visibility into whether fetch latency or batch sizing is the bottleneck.
How did you test it?
Unit test and simulation
Potential risks
Possible increase in memory usage and RPC load with the increase of the number of task fetchers. Setting high parallelism with low rate limits wastes resources as goroutines wait on rate limiters. Requires careful tuning.
Default value is set to 1 which was already the default behavior. With no changes to ReplicationTaskFetcherParallelism this change will be a NOOP.
Release notes
Fixed Feature: Replication task fetchers now support parallel fetch operations via the ReplicationTaskFetcherParallelism dynamic config (defaults to 1 for backward compatibility). This improves replication throughput in large deployments with thousands of shards.
New Metrics:
Documentation Changes