开发者

Unix: TCP keepalive

开发者 https://www.devze.com 2023-01-31 13:59 出处:网络
I read once that there is a common mistake in configuring TCP keepalive parameter in Unix. There is some confusion between milliseconds and seconds.

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 inf开发者_StackOverflow社区ormation 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?


  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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号