HttpClient 在压力下超时缓慢

发布于 2024-09-29 09:26:07 字数 180 浏览 6 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

七堇年 2024-10-06 09:26:07

嗯,这已经是“初级的”了。我们没有使用 MultiThreadedHttpConnectionManager,因此所有请求都被序列化... 。

Wel, this has been "elementary". We weren't using MultiThreadedHttpConnectionManager, so all requests were serialized....

戏蝶舞 2024-10-06 09:26:07

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文