socket: Add support for TCP defer accept
TCP_DEFER_ACCEPT Allow a listener to be awakened only when data arrives on the socket. If TCP_DEFER_ACCEPT set on a server-side listening socket, the TCP/IP stack will not to wait for the final ACK packet and not to initiate the process until the first packet of real data has arrived. After sending the SYN/ACK, the server will then wait for a data packet from a client. Now, only three packets will be sent over the network, and the connection establishment delay will be significantly reduced.
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
209e9dcd7b
commit
cc567c9bea
@@ -545,6 +545,47 @@
|
||||
for details.).</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>DeferAccept=</varname></term>
|
||||
|
||||
<listitem><para>Takes time (in
|
||||
seconds) as argument. If set, the
|
||||
listening process will be awakened
|
||||
only when data arrives on the socket,
|
||||
and not immediately when connection is
|
||||
established. When this option is set,
|
||||
the
|
||||
<constant>TCP_DEFER_ACCEPT</constant>
|
||||
socket option will be used (see
|
||||
<citerefentry><refentrytitle>tcp</refentrytitle><manvolnum>7</manvolnum></citerefentry>),
|
||||
and the kernel will ignore initial ACK
|
||||
packets without any data. The argument
|
||||
specifies the approximate amount of
|
||||
time the kernel should wait for
|
||||
incoming data before falling back to
|
||||
the normal behaviour of honouring
|
||||
empty ACK packets. This option is
|
||||
beneficial for protocols where the
|
||||
client sends the data first (e.g.
|
||||
HTTP, in contrast to SMTP), because
|
||||
the server process will not be woken
|
||||
up unnecessarily before it can take
|
||||
any action.
|
||||
</para>
|
||||
|
||||
<para>If the client also uses the
|
||||
<constant>TCP_DEFER_ACCEPT</constant>
|
||||
option, the latency of the initial
|
||||
connection may be reduced, because the
|
||||
kernel will send data in the final
|
||||
packet establishing the connection
|
||||
(the third packet in the "three-way
|
||||
handshake").</para>
|
||||
|
||||
<para>Disabled by default.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>ReceiveBuffer=</varname></term>
|
||||
<term><varname>SendBuffer=</varname></term>
|
||||
|
||||
Reference in New Issue
Block a user