HttpClient 在压力下超时缓慢
我正在使用 HttpClient 3.1 连接到不同的 Web 服务。我已将 SO_TIMEOUT 和 ConnectionTimeout 设置为 3 秒。我正在模拟一个需要超过 3 秒才能响应的服务。然而,实际的超时时间要长得多,长达几分钟甚至更长。最后,服务器内存不足并停止运行。
到底是怎么回事?为什么我的连接没有及时超时?
I am using HttpClient 3.1 to connect to a different web services. I have set SO_TIMEOUT and ConnectionTimeout to 3 seconds. I am simulating a service that takes more than 3 seconds to respond. However, actual timeout is much longer, up to few minutes and more. In the end, server is out of memory and stalls.
What is going on? Why my connections are not timing out in time?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
嗯,这已经是“初级的”了。我们没有使用 MultiThreadedHttpConnectionManager,因此所有请求都被序列化... 。
Wel, this has been "elementary". We weren't using MultiThreadedHttpConnectionManager, so all requests were serialized....
SO_TIMEOUT 仅当 HTTP 连接不活动时才会启动。您确定您的连接处于空闲状态吗?或者您的服务器正在发送任何分块响应?
SO_TIMEOUT will kick in only when there is an inactivity on the HTTP connection. Are you sure, your connection is idle? Or your server is sending any chunked response?