Skip to content

[FEATURE REQ] Allow parallelism configuration for readMany #48442

@zoltan-toth-mw

Description

@zoltan-toth-mw

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue points to a problem in the data-plane of the library.CosmosService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions