ibaPDA measurements of automation devices using TCP/IP show spikes in the data.
Errors shown in ibaPDA
Incomplete telegrams or spikes in the data values (see examples in the following figures)


Cause
Nagle's algorithm is one mechanism for improving TCP efficiency by reducing the number of small packets sent over the network and collecting several data blocks before sending the data over the network.
Because the Generic TCP interface does not use an application level protocol, the receiver ibaPDA cannot handle these merged messages correctly. The Generic TCP interface expects only 1 datagram per TCP message with always the same layout and length.
However, the Nagle's Algorithm and the option Delayed ACK can negatively interact in TCP/IP networks, see also TCP performance problems caused by Delayed Acknowledge:
The Delayed ACK mechanism tries to send more data per segment if possible. But part of Nagle's algorithm depends on an ACK to send data. So Delayed ACKs are waiting to send the ACK while Nagle's algorithm is waiting to receive the ACK.
This creates random stalls of 200 ms to 500 ms on segments that could otherwise be sent immediately and delivered to the receive-side stack of ibaPDA as application.
Remedy
It is recommended to start with disabling the Delayed ACK mechanism, see chapter TCP performance problems caused by Delayed Acknowledge. In a typical real-time application, the transmitter will then send the new data to ibaPDA with a certain cycle time because the previous data has been acknowledged immediately. Depending on the implementation of the TCP/IP stack on the sender's side, the Nagle's algorithm can still become active and automatically aggregate a number of small buffer messages, causing the algorithm to purposely slow down the transmission.
This can also happen sporadically due to a momentary overload on the sender side that causes the stack to merge some messages.
To disable Nagle's buffering algorithm, use the TCP_NODELAY socket option. The TCP_NODELAY socket option allows the network to bypass Nagle's-induced Delays by disabling Nagle's algorithm, and sending the data as soon as it is available.
Enabling TCP_NODELAY forces a socket to send the data in its buffer, whatever the packet size. The TCP_NODELAY flag is an option that can be enabled on a per-socket basis and is applied when a TCP socket is created.
(See Socket.NoDelay property in .NET applications in the System.Net.Sockets namespace.)
Note |
|
|---|---|
|
Basically, you can avoid such TCP-specific problems by using UDP instead of TCP. The User Datagram Protocol (UDP) is a minimal network protocol that is not connection-oriented and is unsecured against telegram loss. Notably, it does not provide acknowledgments for received data. In stable and high-performance networks, this is usually not critical and can be disregarded due to the cyclic data transmission with ibaPDA. |
|