Ability to pass connection policy configuration values to http client in transport layer#7126
Conversation
…ent to better configure it
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run java - cosmos - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
|
||
| // Default pool size | ||
| Integer maxPoolSize = httpClientConfig.getConfigs().getReactorNettyMaxConnectionPoolSize(); | ||
| Integer maxPoolSize = httpClientConfig.getConfigs().getDirectHttpsMaxConnectionLimit(); |
There was a problem hiding this comment.
isn't HttpClient.createFixed(.) also used for GW?
How does HttpClient.createFixed(.) distinguish between GW and DirectHttps?
There was a problem hiding this comment.
Yes, it is used for both Gateway and Direct Https. They are different and I think that is the problem.
There is no way to set idle connection timeout, max pool size, etc. for Direct Https Client, because it doesn't have connectionPolicy object .
While Gateway Https client reads these values from connectionPolicy object which gets passed to it when we create https client.
To solve this problem, in this PR, I have kept same configuration for Direct Https and Gateway Http Clients. So that end users can configure these http clients through connectionPolicy object.
I believe this problem also persists in V2.
You can see both Gateway and Direct Http clients are built using different configuration.
Gateway: https://github.com/Azure/azure-cosmosdb-java/blob/master/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentClientImpl.java#L392
Direct Https: https://github.com/Azure/azure-cosmosdb-java/blob/master/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpTransportClient.java#L81
There was a problem hiding this comment.
@kushagraThapar that is kind of on purpose.
GW and Direct are two different modes, and even in Direct mode you may need different configuration setting for the connections to BE nodes vs connections to GW (for query).
As an example, RNTBD has its own way of configuration for its connection stack.
I think we might need ConnectionPolicy#idleTimeToGW and ConnectionPolicy#idleTimeForDiredct something along on those lines. similar for connection pool size.
Let's say if you have 4000 replicas your connection pool size for direct at least has to be >= 4000. but as we know even in Direct mode some request go to GW we need a separate connection pool to GW. With the change you made, increasing Direct connection pool size will unnecessarily increase the connection pool size for GW as well which is not the right thing to do.
Ping me to discuss this offline over teams.
There was a problem hiding this comment.
Agreed, let's talk offline.
|
I looked at the CI failure logs. Btw, here is the port for V3: #7240 |
|
@kushagraThapar can this 9-month old PR be closed out? |
lol, yeah let me close it :) |
|
This is done using |
Currently end users cannot configure http client created in http transport client layer. Connection Policy configuration fields like idleConnectionTimeout, max pool size, and http proxy do not get passed to the http client created in HttpTransportClient.