Forum Discussion
Connection Pooling
Hi Azure Cosmos Db Team,
Is there any best practices to identify if there is connection pooling happening with Cosmos Db JAVA SDK? I see for pointread call the average duration in ms is well around 10 ms from comsos db diagnostic logs but in app insights for the Microsoft.DocumentDb call duration for the cosmos db interaction ( for doing pointread) varies considerably and sometimes reaches around 600 ms especially as number of threads( 5-600 threads step by step in our case) are increased in load testing ? I am suspecting this is happening as the sdk is trying to open a new connection as threads increases and this results in increased latency for "some" requests? I see that for the first call there is a login.microsoftonline.com call happening before doing the actual read in cosmos db but cannot see this call in all the ones with higher latency from app insights probably due to sampling in app insights? We are using direct connection mode in sdk. The direct connection configuration parameters currently used are based on the below documentation.
https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/tune-connection-configurations-java-sdk-v4?tabs=api-async
With Regards,
Nitin Rahim
5 Replies
- JillArmour
Community Manager
I'm trying to get someone to answer your inquiries, I'll let you know when I find someone.- nitinrahimBrass ContributorThank you.
With Regards,
Nitin Rahim- mannu2050
Microsoft
nitinrahim, this needs an investigation on the client side in general it may happen due to web socket exhaustion or high resource usage at the client end as client may be waiting for resources to get allocated. But as I mentioned, we need to investigate the client to check.
Can you raise a support ticket and loop us in? Please ensure you enclosed the client request diagnostics & start / end timestamp for your load testing.
- nitinrahimBrass ContributorHi Team,
Was just following up to see if the team has any inputs regarding the same?
With Regards,
Nitin Rahim- nitinrahimBrass Contributor
Hi Team,
When running load tests the below is a specific error that we are getting for high latency requests.For certain others we see traces for Region Contacted, System Information, ClientCfgs , Storeresponses in application insights for cosmos database calls.
io.netty.channel.ConnectTimeoutException: connection timed out
Our direct connection configuration parameters are below.
connCfg":{"rntbd":"(cto:PT0.6S, nrto:PT5S, icto:PT0S, ieto:PT5H, mcpe:130, mrpc:30, cer:true)
We have set that based on the recommendations below.
https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/tune-connection-configurations-java-sdk-v4?tabs=api-async
https://devblogs.microsoft.com/cosmosdb/java-sdk-v4-diagnostics/
Any insights regarding the same is appreciated.
With Regards,
Nitin Rahim