Use Multicast for One-to-Many Data
If you have one DataWriter that is sending data to more than one or two DataReaders, you can get better overall throughput performance by enabling multicast. This affects throughput in two ways:
- The DataWriter spends less CPU writing the same data to multiple network addresses
- The DataWriter’s network link has less traffic, and therefore fewer packet collisions
In RTI Connext DDS, multicast is enabled for user data by specifying a multicast address in the DataReader’s QoS. This causes the DataReader to listen on that multicast group, and as a part of discovery, it tells the DataWriter to send to that multicast address.
The XML configuration to enable multicast for user data looks like this:
<qos_profile name="OneToManyMulticast"> <datareader_qos> <multicast> <value> <element> <!-- Must be a valid multicast address--> <receive_address>18.104.22.168</receive_address> </element> </value> </multicast> </datareader_qos> </qos_profile>
However, when you do this, you should be aware of some of the details of how multicast works:
- To get the best result from using multicast, you need to enable IGMP snooping on your network switch. If it is not enabled on your switch, multicast will act more like broadcast. This can lead to unnecessary network traffic.
- Multicast packets will only traverse a certain number of routers before being dropped. This is intended to avoid flooding large networks with multicast traffic. The number of routers it will traverse depends on the multicast TTL (time-to-live) value. By default this is set to 1, so multicast data will not traverse even a single router. You can change this in code or XML, but be careful to avoid flooding your network.