我怎样才能调整初始TCP重传超时?

对于大多数基于LAN的应用程序来说,初始的TCP RTO值3s太长。 我怎样才能调低呢? 有没有一个sysctl?

不,你不能; 它在内核中被硬编码。 所以改变内核并重新编译。

#define TCP_TIMEOUT_INIT ((unsigned)(3*HZ)) /* RFC 1122 initial RTO value */ 

这是你应该在你的include / net / tcp.h中得到的。

但我可以看到有人提供了一个补丁 ,即使从来没有尝试过

初始设置不应该影响您的整体性能,因为RTO可以自行调整networking条件。 如果您更改RTO,则可以将其设置为1秒(但不能低于)。

在RFC 1122中对此进行了讨论:

  The following values SHOULD be used to initialize the estimation parameters for a new connection: 
  (a) RTT = 0 seconds. (b) RTO = 3 seconds. (The smoothed variance is to be initialized to the value that will result in this RTO). The recommended upper and lower bounds on the RTO are known to be inadequate on large internets. The lower bound SHOULD be measured in fractions of a second (to accommodate high speed LANs) and the upper bound should be 2*MSL, ie, 240 seconds. DISCUSSION: Experience has shown that these initialization values are reasonable, and that in any case the Karn and Jacobson algorithms make TCP behavior reasonably insensitive to the initial parameter choices. 

RFC 6298是一个build议的更新(2011年6月发布),它说RTO可以初始化为一个较低的值(但不低于1秒),并且包含一个包含数据的附录,certificate1秒是一个合理的初始值。