Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http client connection management is not optimal #92

Open
zhenglaizhang opened this issue Mar 31, 2022 · 1 comment
Open

Http client connection management is not optimal #92

zhenglaizhang opened this issue Mar 31, 2022 · 1 comment

Comments

@zhenglaizhang
Copy link

zhenglaizhang commented Mar 31, 2022

When we dig into the CommonsHttpClientImpl, upon each request, it will create new http client, execute and then close
https://github.com/semi-technologies/weaviate-java-client/blob/85a837c61e096b8bab0512a14ba2c519d9ae421b/src/main/java/technology/semi/weaviate/client/base/http/impl/CommonsHttpClientImpl.java#L112
The http client created by HttpClients.createDefault() has a default connection manager with max=20 and maxPerRoute=2. However it should be put as the CommonsHttpClientImpl class field and shared by multiple http calls and no need to do client close. Otherwise, we may met with following exception under a bit heavy load.

Mar 30, 2022 3:20:23 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.NoRouteToHostException) caught when processing request to {}->[http://10.43.68.129:80](http://10.43.68.129/): Cannot assign requested address (Address not available)
Mar 30, 2022 3:20:23 PM org.apache.http.impl.execchain.RetryExec execute

And going further we can use customized HTTP client connection pool manager to let client optimize the connections based on their loads. And I tried locally this will increase the throughput especially under heavy load.

Creating the issue just for sync up in case you guys are already actively optimizing this. If not I could probably create a PR for this.

@byronvoorbach
Copy link
Member

I think this has been fixed, @antas-marcin?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants