23.5 Zero Copy Transfer Over Shared Memory

For communication within the same node using the built-in shared memory transport, by default Connext DDS copies a sample four times (see Figure 23.3: Number of Copies Out-of-the-Box). FlatData language binding reduces the number of copies to two (see Figure 23.4: Number of Copies Using FlatData Language Binding): the copy of the sample into the shared memory segment in the publishing application and the copy to reassemble the sample in the subscribing application. Two copies, however, may still be too many depending on the sample size and system requirements.

Zero Copy transfer over shared memory, provided as a separate library called nddsmetp, allows reducing the number of copies to zero for communications within the same host. The nddsmetp library can be linked with Connext DDS C or C++ libraries.This feature accomplishes zero copies by using the shared memory (SHMEM) built-in transport to send 16-byte references to samples within a SHMEM segment owned by the DataWriter, instead of using the SHMEM built-in transport to send the serialized sample content by making a copy. See Figure 23.5: Zero Copy Transfer Over Shared Memory.

With Zero Copy transfer over shared memory, there is no need for the DataWriter to serialize a sample, and there is no need for the DataReader to deserialize an incoming sample since the sample is accessed directly on the SHMEM segment created by the DataWriter.

Figure 23.5: Zero Copy Transfer Over Shared Memory

This feature offers the following benefits:

Note: A Zero Copy DataWriter is defined as any DataWriter with the ability to send a sample reference. You can have a DataWriter that does both: sends sample references to Zero Copy DataReaders, and sends serialized samples to non-Zero Copy DataReaders. In this case, the DataWriter is still considered a Zero Copy DataWriter in this documentation.

© 2020 RTI