Unix:TCP 保活
我曾经读到过,在 Unix 中配置 TCP keepalive 参数时存在一个常见错误。毫秒和秒之间存在一些混淆。
问题:
- 有人有关于这个问题的更多信息吗?
- 有谁知道这个参数的建议值是什么?
- 还有其他 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:
- Does anybody have more information about this problem?
- Does anybody know what value is recommended for this param?
- Are there any other Unix parameters that suffer from this confusion?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
RFC 2525(文本,或 HTML) 一般性地识别 TCP 的一些问题,并包括有关“保持活动”的项目。 Wikipedia 也对此进行了讨论,区分了 TCP 和 HTTP keepalived。 TLDP 也有关于该主题的“如何做”。当我使用 Google 搜索并从“tcp keepalive”开始时,有许多针对各种平台和单词(例如“间隔”或“超时”)提供的补全。我没有发现任何毫秒与秒的混淆 - 但我不确定除了新手的错误之外还有什么人会认为这是错误。您需要阅读您感兴趣的系统的手册。
这取决于您的环境 - 没有一个值适合每个人。
POSIX 系统具有数量惊人的亚秒时间结构,有些使用秒和微秒,有些使用秒和纳秒。但这些不是参数——至少不是配置参数。它们只是来自各种系统的遗留接口,最终合并到 POSIX 标准中。在不破坏现有代码的情况下无法更改它们。
其他配置参数往往以特定系统特有(甚至特有)的方式指定。大多数系统上通常都存在参数的一般概念,但细节可能有很大不同。
请记住,大多数网络常量最明智的指定单位是秒,而不是亚秒间隔。
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.
It depends on your context — there's no one single value suitable for everybody.
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.
您系统的手册页包含有关此问题的所有信息。
默认情况下,它是关闭的,默认情况下,当它打开时,它的默认值为两个小时。这应该会让您了解它的用途。微秒的问题当然不会出现。
太宽泛了。
The man page for your system has all the information about this problem.
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.
Too broad.