[patch] delayed acks decrease performances in congestioned networks

Andrea Arcangeli (andrea@e-mind.com)
Sat, 14 Nov 1998 17:31:30 +0100 (CET)


This trace is done from the receiver (the acker).

15:55:34.444225 141.76.20.99.20 > 195.223.140.39.1042: . 9729:9985(256) ack 1 win 32512 [tos 0x8]
15:55:34.904244 141.76.20.99.20 > 195.223.140.39.1042: . 9985:10241(256) ack 1 win 32512 [tos 0x8]
15:55:34.904325 195.223.140.39.1042 > 141.76.20.99.20: . ack 10241 win 31744 (DF)
15:55:35.414288 141.76.20.99.20 > 195.223.140.39.1042: . 10241:10497(256) ack 1 win 32512 [tos 0x8]
^^^^^^
15:55:35.914321 195.223.140.39.1042 > 141.76.20.99.20: . ack 10497 win 32512 (DF)
^^^^^^ delayed ack timeout due a missed packet
15:55:36.384302 141.76.20.99.20 > 195.223.140.39.1042: . 10753:11009(256) ack 1 win 32512 [tos 0x8]
15:55:36.384411 195.223.140.39.1042 > 141.76.20.99.20: . ack 10497 win 32512 (DF)
^^^^^ lost

If I would be the TCP engine I would have understood that at time
~"(15:55:34.904244-15:55:34.444225) + 15:55:35.414288" the packet
10497:.... got lost from the network. I don' t think that setting the
delayed ack timeout to 0.5sec is a good idea. The max timeout should be
calculated in a smoothed way in function of previous received packet.
This is not specified by RFCs AFIK, maybe because they are lazy or to
suggest people to fix broken networks... But since I can' t fix the
network I think that delayed acks should be at least removable via
sysctl. I seen that there is a #define TCP_DELAY_ACKS in sysctl_net_ipv4
but is never used. I don' t think that a congestioned network can be
improved by sending delayed info to the sender when the network lose one
packet every 4/5 packet as here. People on good networks will left the
option enabled as default of course because it's a win for them...

Note that the draft-ietf-tcpimpl-cong-control-01.txt you pointed me out
(thanks ;-) say:

The delayed ACK algorithm specified in [Bra89] SHOULD be used by a
^^^^^^
TCP receiver.

so I think that this new sysctl should be RFC compliant...

Patch against 2.1.128.

Index: linux/net/ipv4/sysctl_net_ipv4.c
diff -u linux/net/ipv4/sysctl_net_ipv4.c:1.1.1.3 linux/net/ipv4/sysctl_net_ipv4.c:1.1.1.2.4.3
--- linux/net/ipv4/sysctl_net_ipv4.c:1.1.1.3 Sat Oct 31 01:16:35 1998
+++ linux/net/ipv4/sysctl_net_ipv4.c Sat Nov 14 16:59:55 1998
@@ -59,6 +59,7 @@
extern int sysctl_tcp_rfc1337;
extern int sysctl_tcp_syn_taildrop;
extern int sysctl_max_syn_backlog;
+extern int sysctl_tcp_delayed_acks;

/* From icmp.c */
extern int sysctl_icmp_destunreach_time;
@@ -172,6 +173,8 @@
&sysctl_icmp_paramprob_time, sizeof(int), 0644, NULL, &proc_dointvec},
{NET_IPV4_ICMP_ECHOREPLY_RATE, "icmp_echoreply_rate",
&sysctl_icmp_echoreply_time, sizeof(int), 0644, NULL, &proc_dointvec},
+ {NET_IPV4_DELAYED_ACKS, "tcp_delayed_acks",
+ &sysctl_tcp_delayed_acks, sizeof(int), 0644, NULL, &proc_dointvec},
{NET_IPV4_ROUTE, "route", NULL, 0, 0555, ipv4_route_table},
{0}
};
Index: linux/net/ipv4/tcp_input.c
diff -u linux/net/ipv4/tcp_input.c:1.1.1.4 linux/net/ipv4/tcp_input.c:1.1.1.2.4.3
--- linux/net/ipv4/tcp_input.c:1.1.1.4 Sun Nov 8 02:39:13 1998
+++ linux/net/ipv4/tcp_input.c Sat Nov 14 16:56:32 1998
@@ -55,6 +55,9 @@
* work without delayed acks.
* Andi Kleen: Process packets with PSH set in the
* fast path.
+ * Andrea Arcangeli: sysctl_tcp_delayed_acks, see the
+ * sysctl declaration for more info.
+ *
*/

#include <linux/config.h>
@@ -81,6 +84,28 @@
int sysctl_tcp_syncookies = SYNC_INIT;
int sysctl_tcp_stdurg;
int sysctl_tcp_rfc1337;
+/*
+ * The next sysctl allow to disable delayed acks. This is a win on congestioned
+ * network where there is a packet loss every 4/5 packet sent. Example:
+ *
+15:55:34.444225 141.76.20.99.20 > 195.223.140.39.1042: . 9729:9985(256) ack 1
+15:55:34.904244 141.76.20.99.20 > 195.223.140.39.1042: . 9985:10241(256) ack 1
+15:55:34.904325 195.223.140.39.1042 > 141.76.20.99.20: . ack 10241
+15:55:35.414288 141.76.20.99.20 > 195.223.140.39.1042: . 10241:10497(256) ack 1
+ ^^^^^^
+15:55:35.914321 195.223.140.39.1042 > 141.76.20.99.20: . ack 10497
+ ^^^^^^ delayed ack timeout due a missed packet
+15:55:36.384302 141.76.20.99.20 > 195.223.140.39.1042: . 10753:11009(256) ack 1
+15:55:36.384411 195.223.140.39.1042 > 141.76.20.99.20: . ack 10497
+ ^^^^^ lost
+ *
+ * Disabling delayed acks will not make the congestion worse (because we
+ * stop the sender before then using delayed acks). People on good networks
+ * will continue to use delayed acks (default) because that will improve
+ * performance as usual for them.
+ * Andrea Arcangeli 14 Nov 1998
+ */
+int sysctl_tcp_delayed_acks = 1;

static int prune_queue(struct sock *sk);

@@ -1531,7 +1556,9 @@
/* We entered "quick ACK" mode or... */
tcp_in_quickack_mode(tp) ||
/* We have out of order data */
- (skb_peek(&tp->out_of_order_queue) != NULL)) {
+ (skb_peek(&tp->out_of_order_queue) != NULL) ||
+ /* make sure delayed acks are not been disabled via sysctl */
+ !sysctl_tcp_delayed_acks) {
/* Then ack it now */
tcp_send_ack(sk);
} else {
Index: linux/include/linux/sysctl.h
diff -u linux/include/linux/sysctl.h:1.1.1.4 linux/include/linux/sysctl.h:1.1.1.2.4.5
--- linux/include/linux/sysctl.h:1.1.1.4 Fri Nov 13 08:16:41 1998
+++ linux/include/linux/sysctl.h Sat Nov 14 17:01:03 1998
@@ -198,6 +198,7 @@
NET_IPV4_ICMP_TIMEEXCEED_RATE=61,
NET_IPV4_ICMP_PARAMPROB_RATE=62,
NET_IPV4_ICMP_ECHOREPLY_RATE=63,
+ NET_IPV4_DELAYED_ACKS=64,
};

enum {

Andrea Arcangeli

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/