Azure / azure-cosmosdb-java

Java Async SDK for SQL API of Azure Cosmos DB
MIT License
54 stars 61 forks source link

maxBufferedItemCount seems to be partially ignored in azure-cosmos #416

Closed gawlikt closed 2 months ago

gawlikt commented 2 months ago

Describe the bug A clear and concise description of what the bug is.

I have ca 7050 records in my test cosmosdb collection when I execute

    var cosmosQueryOptions = new CosmosQueryRequestOptions();
    cosmosQueryOptions.setPartitionKey(new PartitionKey("specific pk"));
    cosmosQueryOptions.setMaxDegreeOfParallelism(1);
    cosmosQueryOptions.setMaxBufferedItemCount(1);
    cosmosQueryOptions.setResponseContinuationTokenLimitInKb(4);

    container.queryItems(query, cosmosQueryOptions, MyEntity.class).iterableByPage(token, 100).iterator().next()

my expectation is that only one query will be executed against cosmosdb

but when I check

what I assume means that all records are cached (71*100=7100)

in our production env for ca 500 calls to similar function cosmosdb metrics show over 100 000 queries obviously this impact RU and also amount of data transferred to our pods

In our current setup when user requests next page of data we call above function so I'd prefer to have limited bufferedItemCount but this doesn't seem to work

Can I ask for suggestion how can I solve this?

Environment summary SDK Version: azure-cosmos-4.62.0 Java JDK version: 17 OS Version MacOS

kushagraThapar commented 2 months ago

@gawlikt this repository is not maintained anymore and has been deprecated. Can you please open this issue here - https://github.com/Azure/azure-sdk-for-java