admin管理员组文章数量:1389772
my backend Java Spring Boot application is calling a 3rd party web server via restTemplate. I have observed slowness when I switched from std JDK SimpleClientHttpRequestFactory
to Apache http client HttpComponentsClientHttpRequestFactory
. I have tried implementing custom http connection pooling with some random 'good enough' number of PoolingHttpClientConnectionManager
's setMaxTotal
and setDefaultMaxPerRoute
(I only have a few routes) and timeouts.
But, I wanted to cleanly and correctly come up with a number of maxPool and default connections per route. I tried to setup both of those numbers to 100 and saw SocketTimeouts, which I think means that the TCP connection is established but my app is waiting for the web server to send back data. So the underlying web server supports much lower number of concurrent requests on a connection.
Whats the correct way in knowing the downstream web servers capabilities? Should I look at the Connection, Keep-alive
headers in a trial run and configure my application like so?
Also, I want the actual time for all apis. Which means a breakdown of-
- TCP connection establishment(optional),
- Time of waiting when http request is sent out(app now will send the bytes out) and response is received(server starts sending the bytes), considering the connection pool as well.
- Total time of the api(Addition of api processing time + TCP time + waiting for socket data transfer time)
I have a custom Logging interceptor
which is logging all the headers, but from the trace level logs, I saw that the pooling manager connection lease mechanism is after the interceptors, so I cannot really know when the request is actually fired just from looking at the time of the interceptor level log. I need the time when the bytes were actually sent out.
Is there a good way to know when the request was actually fired and response first byte?
I was looking at DEBUG .apache.http.wire
level logs, but I do not need such verbose logs, as it will easily overwhelm my apps log rate.
Whats the best way to get that time of request out and response in?
本文标签: javaHow to debug apache http client thread pool performance bottlenecksStack Overflow
版权声明:本文标题:java - How to debug apache http client thread pool performance bottlenecks - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744593582a2614641.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论