Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: TCP thin-stream detection

Inline function to dynamically detect thin streams based on
the number of packets in flight. Used to dynamically trigger
thin-stream mechanisms if enabled by ioctl or sysctl.

Signed-off-by: Andreas Petlund <apetlund@simula.no>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Andreas Petlund and committed by
David S. Miller
5aa4b32f 16cad981

+55
+47
Documentation/networking/tcp-thin.txt
··· 1 + Thin-streams and TCP 2 + ==================== 3 + A wide range of Internet-based services that use reliable transport 4 + protocols display what we call thin-stream properties. This means 5 + that the application sends data with such a low rate that the 6 + retransmission mechanisms of the transport protocol are not fully 7 + effective. In time-dependent scenarios (like online games, control 8 + systems, stock trading etc.) where the user experience depends 9 + on the data delivery latency, packet loss can be devastating for 10 + the service quality. Extreme latencies are caused by TCP's 11 + dependency on the arrival of new data from the application to trigger 12 + retransmissions effectively through fast retransmit instead of 13 + waiting for long timeouts. 14 + 15 + After analysing a large number of time-dependent interactive 16 + applications, we have seen that they often produce thin streams 17 + and also stay with this traffic pattern throughout its entire 18 + lifespan. The combination of time-dependency and the fact that the 19 + streams provoke high latencies when using TCP is unfortunate. 20 + 21 + In order to reduce application-layer latency when packets are lost, 22 + a set of mechanisms has been made, which address these latency issues 23 + for thin streams. In short, if the kernel detects a thin stream, 24 + the retransmission mechanisms are modified in the following manner: 25 + 26 + 1) If the stream is thin, fast retransmit on the first dupACK. 27 + 2) If the stream is thin, do not apply exponential backoff. 28 + 29 + These enhancements are applied only if the stream is detected as 30 + thin. This is accomplished by defining a threshold for the number 31 + of packets in flight. If there are less than 4 packets in flight, 32 + fast retransmissions can not be triggered, and the stream is prone 33 + to experience high retransmission latencies. 34 + 35 + Since these mechanisms are targeted at time-dependent applications, 36 + they must be specifically activated by the application using the 37 + TCP_THIN_LINEAR_TIMEOUTS and TCP_THIN_DUPACK IOCTLS or the 38 + tcp_thin_linear_timeouts and tcp_thin_dupack sysctls. Both 39 + modifications are turned off by default. 40 + 41 + References 42 + ========== 43 + More information on the modifications, as well as a wide range of 44 + experimental data can be found here: 45 + "Improving latency for interactive, thin-stream applications over 46 + reliable transport" 47 + http://simula.no/research/nd/publications/Simula.nd.477/simula_pdf_file
+8
include/net/tcp.h
··· 1386 1386 tcp_sk(sk)->highest_sack = new; 1387 1387 } 1388 1388 1389 + /* Determines whether this is a thin stream (which may suffer from 1390 + * increased latency). Used to trigger latency-reducing mechanisms. 1391 + */ 1392 + static inline unsigned int tcp_stream_is_thin(struct tcp_sock *tp) 1393 + { 1394 + return tp->packets_out < 4 && !tcp_in_initial_slowstart(tp); 1395 + } 1396 + 1389 1397 /* /proc */ 1390 1398 enum tcp_seq_states { 1391 1399 TCP_SEQ_STATE_LISTENING,