-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Is your feature request related to a problem? Please describe.
I have cross partition queries often with high waitTime while executing readMany requests.
The parallelism in this case is tied to the CPU cores the service has.
My service is already heavily CPU under utilized and it doesn't make sense to increase the CPU cores (kubernetes) to increase parallelism and reduce wait time.
Describe the solution you'd like
CosmosReadManyRequestOptions should have a property to set parallelism.
Describe alternatives you've considered
Hack CPU_CNT's value in com.azure.cosmos.implementation.Configs with aspectj LTW.
Additional context
readMany uses ParallelDocumentQueryExecutionContext for partitions with 2+ items. The number of partition fetches that may run concurrently is computed in fluxSequentialMergeConcurrency:
private int fluxSequentialMergeConcurrency(CosmosQueryRequestOptions options, int numberOfPartitions) {
int parallelism = options.getMaxDegreeOfParallelism();
if (parallelism < 0) {
parallelism = Configs.getCPUCnt(); // ← fallback when -1
} else if (parallelism == 0) {
parallelism = 1;
}
return Math.min(numberOfPartitions, parallelism);
}