Friday, November 04, 2011

TCP/IP Congestion Avoidance

TCP/IP is a jolly clever protocol that now forms the bulk of the traffic that runs across the Internet. Given that routers and gateways along a packets route are entirely at liberty to drop packets without informing either the sender or the recipient (it's up to the client/server to figure out packet sequence and if any packets were lost) there is a very clever way that the IP stack in your computer does packet collision avoidance.
So when TCP establishes a connection it goes through an IP-slow-start. In essence the stack has to "sneak-up" on a transmission speed where packets are being lost faster than they're being sent; when that occurs the stack backs off until packet failure is happening less than new packets are being sent. The initial condition is that the stack can send two packets without getting a confirmation. For every confirmed packet the stack can increase the maximum segment size by one so that two packets can become three and so on. After that there are several commonly used strategies, most commonly "TCP Reno" and "TCP Tahoe". Tahoe reduces the congestion window to one MTU ("Maximum transmission Unit" - typically a 1550 byte packet in Windows) and then go back to the IP-slow-start. Reno halves the size of the congestion window and so backs off slower than Tahoe but hopefully the link has recovered fast enough to make that a better strategy than Reno.

Anyway - as ever the Wikipedia article is very comprehensive;

No comments: