A good knowledge of the TCP/IP protocol suite is essential to gain full understanding of network performance. Although a full examination of this suite is a bit outside the scope of this book, this appendix briefly reviews the transmission control protocol (TCP) from the perspective of the three-way handshake, interpreting the output of netstat, and a couple of techniques that you can use to improve TCP performance.
This is not a definitive guide — whole books have been written on the subject — but it should hopefully serve as a starting point for those wanting to learn more.
THE THREE-WAY HANDSHAKE
When reviewing waterfall views of web browsers that are loading sites, you can see how, for many resources, there is a delay during which the client establishes a TCP connection to the web server. (This doesn’t happen for all resource requests because connections that are already open are reused if both sides support KeepAlive.) Figure A-1 shows this region indicated by an arrow on the first request for google.com.
So, what exactly is going on in this time frame? TCP is a reliable, connection-based protocol, and before data can flow, a connection must be established. This is done by means of the three-way handshake.
A lot happens during this handshake — for example, timestamps and sequence numbers are set (so that if packets arrive in the wrong ...