network-programmingudpmulticastpacket-loss

Packet drops in multicast when multiple instance of listner are running


I have a multicast server which is continuously sending out multicast packets. There is one listener that is listening to this data on the same machine (loop-back multicast). When only one instance of listener is running I see no packet drops but once I run multiple instances, I see packets being dropped by both instance of the listener. Can somebody explain why this is happening and whether there is any opensource solution to tackle this problem? Thanks in advance!


Solution

  • UDP does not provide any reliability mechanisms. This means that if a layer 3 packet is lost, there is no way to recover it.

    On a localhost connection, packets can be lost by queues overflowing. The transmit queue can overflow if the application temporarily writes data faster than the OS can service the queue. Likewise, the receive queue can overflow if the application does not read data fast enough. With two listeners, the system is doing more work, and thus overflows are more likely.

    In Linux, netstat -su will show you RcvbufErrors and SndbufErrors. You can increase the size of these buffers using setsockopt SO_SNDBUF and SO_RCVBUF. These values are limited by /proc/sys/net/core/wmem_max and rmem_max.

    In Windows, it appears the same socktopts are available, and the defaults can be changed as is done here.