时间telnet apache 2.4.33 centOS7

time telnet apache 2.4.33 centOS7

当我在 centOS7 上尝试 time telnet XX.XX.XX.XX 80 我的 apache 2.4.6 server 时,结果是 51 sec

我设法用 reqtimeout_module 使用

降低了它
RequestReadTimeout header=1
RequestReadTimeout body=1

但绝不会少于 32 秒。找到的信息,关于这个,是 2.4.6 上的一个已知错误(如果我理解正确的话)并且 30sec 是硬编码的并且无法更改。

所以我将其更新为 2.4.33 但没有任何改变。有什么办法可以缩短这个时间吗?

你可以在/etc/httpd/conf/httpd.conf里面设置AcceptFilter http none

默认情况下,在 Linux AcceptFilter is using the TCP_DEFER_ACCEPT socket option (from manpages):

TCP_DEFER_ACCEPT (since Linux 2.4)
  Allow a listener to be awakened only when data arrives on the
  socket.  Takes an integer value (seconds), this can bound the
  maximum number of attempts TCP will make to complete the
  connection.  This option should not be used in code intended
  to be portable.

centos7 上该选项的默认值似乎是 30see this answer)。

另一种方法是使用 apache-module-sockopts:

LoadModule sockopts_module libexec/mod_sockopts.so
AddModule mod_sockopts.c

<IfModule mod_sockopts.c>
    # TCP_DEFER_ACCEPT
    SoTcpDeferAccept 20
</IfModule>