FIX: MSMQ Delays in Sending Messages


Under most circumstances, Microsoft Message Queue Server (MSMQ) applications are only interested in quickly receiving acknowledgement that their messages have been accepted by the local queue manager for delivery to the target queue. Delivery of these small messages on the network may be impacted by TCP nagling, which can be seen by using a network monitoring tool. Note that the nagle algorithm is described in further detail in the "More Information" section of this article.


When sending small messages, the TCP nagle algorithm implements a 200 millisecond delay that slows the delivery of small messages from a computer running MSMQ to the MSMQ target computer.


IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:
256986 Description of the Microsoft Windows Registry

For more immediate delivery of small messages, a new MSMQ registry key has been introduced in Windows NT 4.0 Service Pack 6. The following new registry key is of type "REG_DWORD" and is added under the MSMQ parameters:

This key may be set to disable TCP nagling. It has valid values of "0" and "1", with a default of "0" (enable nagling). By default, message queuing enables nagling on the TCP sockets it uses. Enabling nagling here improves overall performance, but it might briefly delay transmission of smaller packets. You can add this entry to the registry with a value of "1" to disable nagling, as the following code illustrates, if the delay is undesirable or unacceptable.

Value Meaning

0 Nagling is enabled.
1 Nagling is disabled.


This bug was corrected in Windows NT 4.0 Service Pack 6.

More Information

Transmission Control Protocol/Internet Protocol (TCP/IP) for Windows NT Server and Windows NT Workstation implements the nagle algorithm described in Requests for Comments (RFC) 896. The purpose of this algorithm is to reduce the number of "tiny" segments sent, especially on high-delay (remote) links. The nagle algorithm allows only one small segment to be outstanding at a time without acknowledgment. If more small segments are generated while awaiting the Ack property for the first one, then these segments are merged into one larger segment. Any full-sized segment is always transmitted immediately, assuming that there is a sufficient receipt window available. The nagle algorithm is effective in reducing the number of packets sent by interactive programs, such as Telnet, especially over slow links. For specific data flows, the nagle algorithm can delay delivery of messages. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

214397 INFO: Design Issues - Sending Data Segments Over TCP w/Winsock

ID d'article : 241777 - Dernière mise à jour : 11 juin 2002 - Révision : 1