Monday, October 27, 2008

Nagle or not Nagle?

What is the Nagle algorithm in reference to TCP/IP?

Nagle's algorithm is a way of avoiding network congestion by limiting to at most one the number of "tinygrams" (that is, packets that are less than full size) an application can have outstanding at once. It does this by concatenating small segments until it has a full segment or it receives an acknowledgment of the outstanding small segment. The algorithm was proposed by John Nagle in RFC896. Its latest incarnation, which differs slightly from Nagle's original formulation, is described in RFC1122.

The Nagle algorithm can sometimes interact with the TCP's "delayed ACK" mechanism, another congestion avoidance strategy, in a way that increases network congestion and delay. For this reason, it is sometimes disabled, but this is appropriate only in very special circumstances. See the book Effective TCP/IP Programming or Rich Stevens' TCP/IP Illustrated, for complete details.

** Definition taken from searchnetworkingchannel.techtarget.com

This has been a problem with Windows OS (and probably with other OS as well) that TCP connection waits to send next packets unless an acknowledgment is received. One of the Clients reported a drastically reduced performance in Coherence's multi-cluster data replication strategy. When nothing was found even after reviewing the architecture, code reviewing a number of times and involvement of upper management, we had to bring in a Top Coherence expert and he tracked the problem in 15 minutes. It was Nagle.

No comments: