From owner-freebsd-net@FreeBSD.ORG Thu Nov 27 14:03:26 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8B221065675 for ; Thu, 27 Nov 2008 14:03:26 +0000 (UTC) (envelope-from dwmalone@maths.tcd.ie) Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [IPv6:2001:770:10:300::86e2:510b]) by mx1.freebsd.org (Postfix) with SMTP id 377E88FC26 for ; Thu, 27 Nov 2008 14:03:26 +0000 (UTC) (envelope-from dwmalone@maths.tcd.ie) Received: from walton.maths.tcd.ie ([134.226.81.10] helo=walton.maths.tcd.ie) by salmon.maths.tcd.ie with SMTP id ; 27 Nov 2008 14:03:24 +0000 (GMT) Received: from localhost ([127.0.0.1] helo=maths.tcd.ie) by walton.maths.tcd.ie with SMTP id ; 27 Nov 2008 14:03:20 +0000 (GMT) To: freebsd-net@freebsd.org Date: Thu, 27 Nov 2008 14:03:20 +0000 From: David Malone Message-ID: <200811271403.aa55110@walton.maths.tcd.ie> Cc: Kevin Oberman Subject: FreeBSD Window updates X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2008 14:03:26 -0000 I was looking at some tcpdumps from a FreeBSD box receiving a TCP stream with someone yesterday and noticed that it seemed to be generating quite a lot of dupliacte acks. Looking more carefully, we noticed that the duplicates were actually window updates. The code for sending window updates can be found in: http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/netinet/tcp_output.c?annot ate=1.157 around lines 541-565. It seems that we generate a window update if the available buffer space changes by more than two packets, or if it changes by more than half the buffer size. This is probably a little aggressive, and in some cases seems to result in bursts of window updates that look like they should be batched. I wonder if it would make sense to not do a window update if a delayed ack is scheduled? It might even be possible to do them as a delayed ack without causing problems. I note that there is at least one PR mentioning we generate many window updates: http://www.freebsd.org/cgi/query-pr.cgi?pr=116335 I also wonder if it might cause non-FreeBSD senders to back off, we are careful not to retransmit if we get window updates (see http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/netinet/tcp_input.c?annota te=1.392 about line 1836, but other OSes might not be and that might degrade our performance when receiving from a non-FreeBSD sender. David.