Silly window syndrome
Silly window syndrome (SWS) is a problem in computer networking caused by poorly implemented TCP flow control. A serious problem can arise in the sliding window operation when the sending application program creates data slowly, the receiving application program consumes data slowly, or both. If a server with this problem is unable to process all incoming data, it requests that its clients reduce the amount of data they send at a time (the window setting on a TCP packet). If the server continues to be unable to process all incoming data, the window becomes smaller and smaller, sometimes to the point that the data transmitted is smaller than the packet header, making data transmission extremely inefficient. The name of this problem is due to the window size shrinking to a "silly" value.
Since there is a certain amount of overhead associated with processing each packet, the increased number of packets means increased overhead to process a decreasing amount of data. The end result is thrashing.
Solution
When there is no synchronization between the sender and receiver regarding capacity of the flow of data or the size of the packet, the window syndrome problem is created. When the silly window syndrome is created by the sender, Nagle's algorithm is used. Nagle's solution requires that the sender send the first segment even if it is a small one, then that it wait until an ACK is received or a maximum sized segment (MSS) is accumulated.
When the silly window syndrome is created by the receiver, David D Clark's solution is used. Clark's solution closes the window until another segment of maximum segment size (MSS) can be received or the buffer is half empty.
There are 3 causes of SWS:
- When the server announces Empty space as 0
- When client is able to generate only 1 byte at a time
- When server is able to consume only 1 byte at a time
During SWS, efficiency of communication is almost 0, so SWS duration should be short as possible.
Send-side silly window avoidance
A heuristic method where the send TCP must allow the sending application to make "write" calls, and collect the data transferred in each call before transmitting it into a large segment. The sending TCP delays sending segments until it can accumulate reasonable amounts of data, which is known as clumping.
Receive-side silly window avoidance
A heuristic method that a receiver uses to maintain an internal record of the available window, and delay advertising an increase in window size to the sender until it can advance a significant amount. This amount depends on the receiver's buffer size and maximum segment size. By using this method, it prevents small window advertisements where received applications extract data octets slowly.
References
- Comer, Douglas E. (2006). Internetworking with TCP/IP (5 ed.). Prentice Hall: Upper Saddle River, NJ.
- Postel, J (1981). NCP/TCP Transition Plan. p. 6. doi:10.17487/RFC0801. RFC 801. Retrieved 5 October 2016.
Some TCP implementations did not protect against silly window syndrome.