Subject: Re: Strange Nagle effect on 1.6.2
To: Stuart Brooks <stuartb@cat.co.za>
From: David Laight <david@l8s.co.uk>
List: tech-net
Date: 05/30/2005 18:59:03
On Mon, May 30, 2005 at 02:11:57PM +0200, Stuart Brooks wrote:
> It seems to me (looking at the tcp dump) like the
> Nagle algorithm is kicking in, but I can't work out why.
Comments before frames:
Sending two full fragments.
> 1 642.651606 SRC.30010 > DEST.63394: . 389586:391034(1448) ack 1 win
> 17520 <...>
> 2 642.651878 SRC.30010 > DEST.63394: . 391034:392482(1448) ack 1 win
> 17520 <...>
An ack generated by earlier traffic.
> 3 642.653052 DEST.63394 > SRC.30010: . ack 389586 win 5936 <...>
Ack for frames 1 and 2 generated because traditionally TCP acks every
other received data packet.
> 4 642.653428 DEST.63394 > SRC.30010: . ack 392482 win 3040 <...>
No outstanding data so Nagle allows us to send the partial frame.
> 5 642.653453 SRC.30010 > DEST.63394: P 392482:392878(396) ack 1 win
> 17520 <...>
Window opening ack for frames 1 and 2 (not acking 5)
> 6 642.654174 DEST.63394 > SRC.30010: . ack 392482 win 17520 <...>
Three more full sized transmits.
> 7 642.658572 SRC.30010 > DEST.63394: . 392878:394326(1448) ack 1 win
> 17520 <...>
> 8 642.658598 SRC.30010 > DEST.63394: . 394326:395774(1448) ack 1 win
> 17520 <...>
> 9 642.658655 SRC.30010 > DEST.63394: . 395774:397222(1448) ack 1 win
> 17520 <...>
Ack generated by 10 - probably because a 2nd data frame.
> 10 642.658910 DEST.63394 > SRC.30010: . ack 394326 win 16072 <...>
Ack generated after 8, fully opening window (not sure why, but valid)
Note that 9 is still unacked, so the sender's nagle code stops the
last fragment being transmitted.
> 11 642.659195 DEST.63394 > SRC.30010: . ack 395774 win 17520 <...>
Timeout ack after 200ms
> 12 642.856448 DEST.63394 > SRC.30010: . ack 397222 win 17520 <...>
No data outstanding, to nagle lets the last fragment out.
> 13 642.856484 SRC.30010 > DEST.63394: P 397222:398512(1290) ack 1 win
> 17520 <...>
Acking all data
> 14 643.056432 DEST.63394 > SRC.30010: . ack 398512 win 17520 <...>
Looks like Nagle is screwing up another data exchange.
Nagle works well for character echo [1], and doesn't obstruct file transfer,
but causes grief with large classes of data transfer protocol.
David
[1] Except when the 'echo' is a single write() that is too large to fit
in a single IP frame (eg page forwards on a resonably sized pty).
--
David Laight: david@l8s.co.uk