[e2e] Data + FIN
Erich Nahum
nahum at watson.ibm.com
Tue Jan 23 14:01:09 PST 2001
John Border writes:
>
> Is it common practice for a TCP stack to send a FIN with the last segment of
> data if the opportunity presents itself? We ran into the following
> scenario...
>
> SYN ------------->
> <------------- SYN+ACK
> ACK ------------->
> X<----- DATA
> <------------- FIN
> ACK -------------> [Doesn't ACK the FIN]
> Retransmission Timeout
> <------------- DATA+FIN
>
> We had not seen this before and were wondering if this is typical.
Not only is this legal, but I believe it happens relatively
frequently with HTTP 1.0 traffic for large files. A WWW server
will queue a bunch of data (say 64KB) into the socket layer,
then close the socket. Since it can write the data asynchronously
into the socket buffer faster than the socket drains (i.e., is
acked by the remote host), the tcp code can identify the last segment
and piggyback the FIN seamlessly.
In fact, certain implementations of sendfile() include a close
option to explicitly cause this to happen on *all* transfers,
not just large ones where the race condition above happens.
This not only reduces the number of packets required to transfer
an HTTP response (typically 8-14 KB), and thus improves network
utilization, but is also more efficient in terms of server CPU
cycles. It avoids another transition between user and kernel
space and reduces the number of packets host CPU has to queue
to the network card. AIX does this, as does NT, I believe,
and most likely other Unixes. I have a paper which includes
this very topic if people are interested.
As to *how frequently* it happens, somebody with ready access
to packet traces can better answer that question. Two years ago,
Anja Feldman gave me a number that was (I believe) on the order
of 40% of TCP connection were doing this, based on a packet trace
from AT&T.
-Erich
--
Erich M. Nahum IBM T.J. Watson Research Center
Networking Research P.O. Box 704
nahum at watson.ibm.com Yorktown Heights NY 10598
More information about the end2end-interest
mailing list