简体   繁体   English

PoolingHttpClientConnectionManager和保持活动设置

[英]PoolingHttpClientConnectionManager and keep-alive setting

I have performance critical application with http requests pool. 我有带有HTTP请求池的性能至关重要的应用程序。 My application service is bursty processing batch files. 我的应用程序服务是突发处理批处理文件。 Does PoolingHttpClientConnectionManager re-use connection for multiple requests? PoolingHttpClientConnectionManager是否为多个请求重用连接? If yes, how do i calculate optimal keep-alive time? 如果是,我该如何计算最佳保持时间? My http request response time is avg 25 ms. 我的http请求响应时间平均为25毫秒。

Yes, it will reuse connections for multiple requests. 是的,它将对多个请求重用连接。 Note that it pools connections with a maximum number per route and the default is 2, so you will almost certainly want to increase that or it will become a bottleneck! 请注意,它汇集了每个路由的最大连接数,默认值为2,因此您几乎可以肯定希望增加连接数,否则它将成为瓶颈!

Calculating the best keep-alive time is non-trivial as it depends on many things. 计算最佳的保持活动时间并非易事,因为它取决于很多事情。 How often are the bursts, what keep-alive time does the web front or application server support and so on. 突发频率多久一次,Web前端或应用程序服务器支持什么保持活动时间等等。 Generally I would start with something like 5-10 seconds and measure. 通常,我会从5-10秒开始测量。 If you know that the bursts are 8 seconds apart, aim for something slightly larger. 如果您知道爆发间隔为8秒,则将目标对准更大一点的目标。 If the bursts are more than a few minutes apart, keeping the connections alive for that long will be problematic as they tend to time out (firewalls, server-side close, ...). 如果突发间隔不超过几分钟,那么保持连接的活动时间会很长,因为它们往往会超时(防火墙,服务器端关闭等)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM