Unix:TCP 保活

发布于 2024-10-08 12:48:26 字数 171 浏览 2 评论 0原文

我曾经读到过,在 Unix 中配置 TCP keepalive 参数时存在一个常见错误。毫秒和秒之间存在一些混淆。

问题:

  1. 有人有关于这个问题的更多信息吗?
  2. 有谁知道这个参数的建议值是什么?
  3. 还有其他 Unix 参数会遭受这种混乱吗?

I read once that there is a common mistake in configuring TCP keepalive parameter in Unix. There is some confusion between milliseconds and seconds.

Questions:

  1. Does anybody have more information about this problem?
  2. Does anybody know what value is recommended for this param?
  3. Are there any other Unix parameters that suffer from this confusion?

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

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

发布评论

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

评论(2

杀お生予夺 2024-10-15 12:48:26
  1. RFC 2525(文本,或 HTML) 一般性地识别 TCP 的一些问题,并包括有关“保持活动”的项目。 Wikipedia 也对此进行了讨论,区分了 TCP 和 HTTP keepalived。 TLDP 也有关于该主题的“如何做”。当我使用 Google 搜索并从“tcp keepalive”开始时,有许多针对各种平台和单词(例如“间隔”或“超时”)提供的补全。我没有发现任何毫秒与秒的混淆 - 但我不确定除了新手的错误之外还有什么人会认为这是错误。您需要阅读您感兴趣的系统的手册。

  2. 这取决于您的环境 - 没有一个值适合每个人。

  3. POSIX 系统具有数量惊人的亚秒时间结构,有些使用秒和微秒,有些使用秒和纳秒。但这些不是参数——至少不是配置参数。它们只是来自各种系统的遗留接口,最终合并到 POSIX 标准中。在不破坏现有代码的情况下无法更改它们。

    其他配置参数往往以特定系统特有(甚至特有)的方式指定。大多数系统上通常都存在参数的一般概念,但细节可能有很大不同。

    请记住,大多数网络常量最明智的指定单位是秒,而不是亚秒间隔。

  1. RFC 2525 (text, or HTML) identifies some problems with TCP generally and includes items on 'keep alive'. Wikipedia has a discussion about it too, distinguishing between TCP and HTTP keep alive. TLDP has a 'how to' on the subject too. When I use Google search and start with 'tcp keepalive', there are numerous offered completions for various platforms and words such as 'interval' or 'timeout'. I didn't spot any milliseconds vs seconds confusion - but I'm not sure anyone would consider that anything other than a novice's bug. You need to read the manual(s) for your system(s) of interest.

  2. It depends on your context — there's no one single value suitable for everybody.

  3. The POSIX system has a distressingly large number of sub-second time structures, some using seconds and microseconds, some using seconds and nanoseconds. These aren't parameters though — at least, not configuration parameters. They are simply the legacy interfaces from various systems that eventually got merged into the POSIX standard. They couldn't be changed without breaking the existing code.

    Other configuration parameters tend to be specified in ways particular (or even peculiar) to a specific system. The general concept for the parameter is usually present on most systems, but the details can be very different.

    Remember that most networking constants are most sensibly specified in seconds rather than sub-second intervals.

笑饮青盏花 2024-10-15 12:48:26

有人有关于这个问题的更多信息吗?

您系统的手册页包含有关此问题的所有信息。

有人知道这个参数的建议值是什么吗?

默认情况下,它是关闭的,默认情况下,当它打开时,它的默认值为两个小时。这应该会让您了解它的用途。微秒的问题当然不会出现。

还有其他 Unix 参数会遭受这种混乱吗?

太宽泛了。

Does anybody have more information about this problem?

The man page for your system has all the information about this problem.

Does anybody know what value is recommended for this param?

By default it is off, and by default when it is turned on it has a default value of two hours. That should give you some idea of how it is intended to be used. The question of microseconds certainly does not arise.

Are there any other Unix parameters that suffer from this confusion?

Too broad.

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