FlatData Latency


Connext 6 introduces two features - Zero Copy Transfer over Shared Memory and FlatData Language Binding. These features enable the middleware to reduce the number of copies involved in sending a sample, resulting in lower latencies. In the case of Zero Copy Transfer over Shared Memory, a fixed minimal latency is guaranteed regardless of the size of the sample.

To learn more about these two features, refer to the User's Manual and the FlatData section of the API Reference.

Example Description

This example demonstrates the benefits of Zero Copy Transfer over Shared Memory and FlatData Language Binding using a large-data ping/pong latency application. The applications are written in C++11 using the modern C++ API. However, the traditional C++ API supports both features as well.

CameraImage_publisher publishes the ping topic and subscribes to the pong topic; CameraImage_subscriber subscribes to the ping topic and publishes the pong topic. Both topics use the same type, CameraImage, containing a 25MB array.

Each application can be run in 4 different modes by using the -mode command-line parameter:

  • Mode 1 - FlatData
  • Mode 2 - Zero Copy
  • Mode 3 - FlatData + Zero Copy
  • Mode 4 - Regular DDS application

You can choose the same or a different mode for each application.

The applications can run on the same or different nodes, although the benefits of the Zero Copy Transfer over Shared Memory can be observed only when running on the same node.

The example application allows one-to-one tests and is not prepared to run multiple subscribers and/or publisher.

Download Example

Browse Example

Or browse it in GitHub.

Build Example

Use rtiddsgen to generate a makefile for your machine's architecture and compiler. For example:

rtiddsgen -language C++11 -additionalHeaderFile Common.hpp -example <your_target_architecture> CameraImage.idl

You may get messages saying that some files already exist and will not be replaced. You can safely ignore those messages, since all the source files for this example are already provided.

Compile the Publisher and Subscriber apps:

make -f <makefile_for_your_target_architecture>

The executables CameraImage_publisher and CameraImage_subscriber are located under objs/\<architecture\>.