Sunday, February 07, 2010

WxEmwin - Internet Ingest - Pauses between some packets

One of my users asked an interesting question today about WxEmwin's Internet ingest engine.  The user asked why there were pauses between some of the packets.  The user noted that data was being received ok, but it looked like there was some delay for some packets.

At 9600 baud, the current EMWIN data rate, one packet should be received about every second.  If the ingest engine is receiving a version 2 packet, the time between the packets could be longer.  A compressed packet increases the time between packets.

There are also other forces at work.  The TCP/IP subsystem in Windows uses the Nagle algorithm to improve the efficiency of the network by reducing the number of packets sent.  See Wikipedia's definition.

Windows may combine shorter packets into one larger packet before it is transmitted.  This act increases the efficiency of the network, but does cause small delays in packets.  The maximum transmission unit (MTU) for ethernet is 1500 bytes.  See Wikipedia.  This number could be less depending on the configuration of the network. 

A version 1 EMWIN packet contains 1106 bytes.  This number is less than a MTU of 1500 bytes.  Because of this windows could add additional bytes from the next EMWIN packet to reach the MTU support by the local network.  If the MTU is smaller it is possible that it could take multiple TCP/IP packets to transmit one version 1 EMWIN packet.

For version 2 EMWIN packets, this phenomena is more pronounced.  Version 2 packets are variable length.  This means that windows could possibly combine one or more packets into one larger packet before it is transmitted.

Regardless of whether packets are combined, WxEmwin's Internet ingest code will process the received packets properly.  You may simply notice some pauses in the status window.

Note:  The next release of WxBBSrvr will disable the Nagle algorithm so that I can evaluate the effect on the received data.

No comments: