I have a container with 10k RUs (Manual).
When using CosmosAsyncContainer, I want to get the data in batches. I used below method to do the same
public Iterable<FeedResponse<Data>> getStatusEvents(String container, String continueToken, int batchSize) {
CosmosAsyncContainer cosmosAsyncContainer = cosmosAsyncDatabase.getContainer(container);
log.info("Through put : " + Objects.requireNonNull(cosmosAsyncContainer.readThroughput().block()).getMinThroughput()); // It gives 400
try {
return cosmosAsyncContainer.queryItems("SELECT * FROM c", Data.class).byPage(continueToken, batchSize).toIterable();
} catch (CosmosException cosmosException) {
return null;
}
}
Now when using above it gives the response in 500 size batches instead of 1000.
I have also tried to increase manual through put to 10k by code but it still give data in 500 batches.
cosmosAsyncContainer.replaceThroughput(ThroughputProperties.createManualThroughput(10000));
Document size for one record is around 6642 bytes
So how can I get the batches of 1000 Size instead of 500 size.
Maximum return payload size is 4MB. Dividing that by 6642, you get around 600 documents. Then factor in some additional overhead, and this likely is why you're getting around 500 (are you getting exactly 500 items each time?). Returned payload size & count is unrelated to a container's RU/sec setting.