典型的网络套接字超时

发布于 2024-10-08 14:42:38 字数 99 浏览 0 评论 0原文

我很想知道当今生产中使用的典型网络套接字超时值是多少。

我目前在 Java 应用程序中使用了 30 秒,但想听听其他用途,特别是对于互联网通信。

谢谢。

I'm interested to know, what is the typical network socket timeout value, used in production today.

I'm currently using 30 seconds in our Java application, but would like to hear what other using, especially for Internet communications.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

请你别敷衍 2024-10-15 14:42:39

不存在所谓的“典型”套接字超时。相反,您应该根据应用程序要求选择超时。诸如以下问题:

  • 是否有用户在等待响应?
  • 超时是否可能发生?
  • 设置“太长”的超时是否会占用大量资源或延迟处理?
  • 当等待更长的时间就会得到结果时,设置“太短”的超时是否会导致处理浪费?
  • 是否有一种保持活动机制......以便您可以区分(例如)网络故障和远程服务器花费很长时间?

最好的策略可能是选择一些直观上合理的值,然后调整它们。

There is no such thing as a "typical" socket timeout. Rather you should chose the timeout(s) according to the application requirements. Issues such as:

  • Is there a user waiting for the response?
  • Is a timeout a likely event?
  • Does setting a "too long" timeout tie down lots of resources, or delay processing?
  • Does setting a "too short" timeout result in wasted processing when waiting a bit longer would have given results?
  • Is there a keep-alive mechanism ... so that you can distinguish between (say) network failure and the remote server taking a long time?

The best strategy is probably to pick some intuitively sensible values, and then tune them.

空‖城人不在 2024-10-15 14:42:39

没有共同的值,它在很大程度上取决于应用程序(每小时发送多少条消息,发送的消息越多,超时就越短)和所使用的网络(通过互联网的超时时间比通过本地网络的超时时间长)。

There is no common value, it heavily depends on the application (how many messages are sent per hour, the more messages being sent the lower your timeout can be) and the network used (longer timeout over the internet than over a local network).

我爱人 2024-10-15 14:42:39

根据经验,您可以使用双倍的事务预期响应时间。但肯定不存在“典型”超时这样的事情。

As a rule of thumb you can use double the expected response time for the transaction. But there is certainly no such thing as a 'typical' timeout.

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