Query APIs in azure-cosmos Java SDK is prefetching too many pages eagerly even if the client's application is blocking on the first page.
This affects both sync and async APIs. Eagerly prefetching is causing increase in RUs, as it is draining all the pages in the background.
Sample code to repro:
CosmosQueryRequestOptions cosmosQueryRequestOptions = new CosmosQueryRequestOptions();
cosmosQueryRequestOptions.setMaxBufferedItemCount(10);
CosmosPagedIterable<ObjectNode> cosmosPagedIterable = cosmosContainer.queryItems("select * from c",
cosmosQueryRequestOptions, ObjectNode.class);
Iterable<FeedResponse<ObjectNode>> feedResponses = cosmosPagedIterable.iterableByPage(10);
// Just creating iterator drains all the results!
Iterator<FeedResponse<ObjectNode>> iterator = feedResponses.iterator();
We have created an issue in project reactor repo to track why the prefetching is not working as expected - reactor/reactor-core#3275
Query APIs in azure-cosmos Java SDK is prefetching too many pages eagerly even if the client's application is blocking on the first page.
This affects both sync and async APIs. Eagerly prefetching is causing increase in RUs, as it is draining all the pages in the background.
Sample code to repro:
We have created an issue in project reactor repo to track why the prefetching is not working as expected - reactor/reactor-core#3275