For a same topic ‘T’, how many copies of a sample (data) are sent from one DataWriter (DW) to many DataReaders (DR)
In short, by default, one copy of a sample is sent per transport locator, where a transport locator uniquely identifies a transport-level destination and is composed of <transport class>://<transport address>: <communication port>
. For example, for UDPv4 a transport locator could be udpv4://192.168.1.2:7400
. For details see Section 14.2.1.1 - Locator Format of the RTI Core Libraries and Utilities User's Manual.
By default all the DDS DataReaders created within a single DDS DomainParticipant get assigned the same transport locator(s). This behavior can be changed by adjusting the DataReader QoS policies "unicast" and "multicast”, see Section 6.5.23 and 7.6.5 of the RTI Core Libraries and Utilities User's Manual.
RTI Connext DDS has built-in support for shared memory and UDP (User Datagram Protocol, both IP v4 and IP v6) transports. It also supports both unicast and multicast communication models with UDP, while shared memory only supports unicast.
When a DDS DataWriter has to send a sample, it gets the list of transport locators that correspond to all the matched DDS DataReaders for the sample (each locator may have one or more associated DataReaders) and sends the sample to each transport locator. The following table summarizes the number of times a sample is sent over a transport when default settings are used. The details are explained in the examples below.
Transport class | Shared memory | UDPv4 / UDPv6 | |
Communication Mode | Unicast | Unicast | Multicast |
Number of times a sample copy is sent | One per destination locator | One per destination locator i.e., there is one destination locator per DataReader NIC | One per DataWriter NIC i.e, to a destination locator with multicast address |
Table 1: Default behavior of a sample transmission from one DataWriter to multiple DataReaders for the same topic.
Note: The following examples assume default configuration unless otherwise stated.
Shared Memory: Shared memory only supports unicast communications.
A DataWriter on topic 'T' will send one copy of the sample to each destination locator. There will be one destination locator per remote participant containing a DataReader on topic 'T' that matches with the DataWriter.
Example 1:
- Participant 1
- DW (T)
- Participant 2
- DR1 (T)
- DR2 (T)
- Participant 3
- DR3 (T)
In Example 1, the DataWriter (DW) will send the sample twice: By default, it will send one copy of the sample for the DataReaders (DR1, DR2) on Participant 2 and one copy for the DataReader (DR3) on Participant 3.
Note: For concurrency reasons, you could associate different locators with DR1 and DR2. In that case, the sample would be sent three times (i.e., once per locator).
User Datagram Protocol (UDP): UDP v4 or UDP v6 transports support unicast and multicast communications.
UDP using Unicast
For unicast communications, there will be at least one destination locator per remote participant containing a DataReader on topic 'T' that matches with the DataWriter. However, the number of destination locators may be higher if the host where the remote participant runs has multiple NICs (Network Interface Cards).
Example 2:
- Participant 1
- DW (T)
- Participant 2 (2 NICs)
- DR1 (T)
- DR2 (T)
- Participant 3 (1 NIC)
- DR3 (T)
- DR4 (T)
In Example 2, the DataWriter (DW) will send the sample three times. It will send two copies of the sample to Participant 2 (one copy per NIC) and one copy of the sample to Participant 3.
Note: As in the shared-memory use case, you may decide to associate independent locators with each DataReader. In this case, the number of copies of the sample sent would be higher (6 sample copies would be sent: 4 to Participant 2 and 2 to Participant 3; in other words, one per NIC and per locator).
UDP using Multicast
For multicast communication, there will be a single destination locator (associated with a multicast address) shared across all the DataReaders on topic 'T', independent of the number of remote DomainParticipants and NICs. However, the UDP transports may send the sample more than once if the DataWriter runs in a host with more than one NIC. For DataWriters with more than one NIC, the transports create a send socket per NIC and set the socket option IP_MULTICAST_IF to guarantee that every sample is sent over all the NICs.
Example 3:
- Participant 1 (1 NIC)
- DW (T)
- Participant 2 (2 NICs) subscribing over Multicast
- DR1 (T)
- DR2 (T)
- Participant 3 (1 NIC) subscribing over Multicast
- DR3 (T)
- DR4(T)
In Example 3, the DataWriter (DW) will send the sample one time, because it has only one sending NIC and only one transport-level (multicast) destination.