CppThroughputBook Instructions

Instructions

Instructions

User Manual: Pdf

Open the PDF directly: View PDF PDF.
Page Count: 14

DownloadCppThroughputBook Instructions
Open PDF In BrowserView PDF
RTI Connext DDS
Core Libraries
Throughput Performance Test
Example Using C++
Instructions
Version 5.2.3

© 2007-2016 Real-Time Innovations, Inc.
All rights reserved.
Printed in U.S.A. First printing.
April 2016.

Trademarks
Real-Time Innovations, RTI, NDDS, RTI Data Distribution Service, DataBus, Connext, Micro DDS, the RTI
logo, 1RTI and the phrase, “Your Systems. Working as one,” are registered trademarks, trademarks or
service marks of Real-Time Innovations, Inc. All other trademarks belong to their respective owners.

Copy and Use Restrictions
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form
(including electronic, mechanical, photocopy, and facsimile) without the prior written permission of RealTime Innovations, Inc. The software described in this document is furnished under and subject to the RTI
software license agreement. The software may be used or copied only under the terms of the license
agreement.

Technical Support
Real-Time Innovations, Inc.
232 E. Java Drive
Sunnyvale, CA 94089
Phone:
(408) 990-7444
Email:
support@rti.com
Website:
https://support.rti.com/

Contents
1

Introduction ........................................................................................................................................1

2

Test Operation ....................................................................................................................................2

3

Paths Mentioned in Documentation ..............................................................................................2

4

Building the Test Applications........................................................................................................2
4.1
Building the Test using the Makefile ....................................................................................3
4.2
Building the Test on a Windows Systems using a Workspace ..........................................4
4.3
Special Note for VxWorks Users using Kernel Mode ........................................................4
4.4
Special Note for VxWorks Users using RTP Mode .............................................................5

5

Command-Line Options ...................................................................................................................5

6

Example Command Line Arguments .............................................................................................7

7

Output Analysis ...............................................................................................................................10

iii

iv

Throughput Test Example Using C++
This document provides instructions on using the RTI® Connext™ DDS throughput test example.

1

Introduction
In this test, the publisher sends data to one or more subscriber applications. The test goes
through the following phases:
1. The publisher signals the subscriber applications that it will commence, and then starts
its own clock. You may specify the duration of the test.
2. The subscriber starts measuring the number of samples received.
3. After the desired duration is over, the publisher signals the subscribers that one experiment is over. The subscriber will then divide the number of samples received by the
elapsed time to report the throughput observed at the receiver. When there are multiple
subscribers, the throughput reported may be different. The publisher also reports the
throughput on its end.
Maximum throughput is achieved when the publisher sends as fast as the subscribers can handle messages without dropping a packet. That is, the maximum throughput is obtained somewhere between the publisher sending too slowly (not maximizing the available pipe) and the
publisher swamping the subscriber (overflowing the pipe).
For this reason, the test makes the publisher try a range of sending rates; the range is provided
as an input to the test. For the absolute maximum throughput to be observed, the optimal sending rate must be in the range. An ever increasing reported throughput throughout the test range
is indicative that the tested range is too small. To observe the maximum throughput, the range
must be extended to include faster sending rates.
By default, the message size ranges from 16 bytes to 8K where the maximum size is indicated in
the IDL file.

1

2

Test Operation
The test code contains two applications: one for the publishing node, one for the subscribing
node(s).
1. You will start the applications from the command line (publisher, then subscribers).
2. The publication application waits for the subscribing applications to announce their participation.
3. Once the publisher recognizes that the specified numbers of subscribers are online, it
starts the test.
4. The test sends a burst of data, sleeps 10ms, and repeats the cycle for a specified duration.
You control the amount of data and the test duration with command-line options.

3

Paths Mentioned in Documentation
The documentation refers to:

❏ 
This refers to the main installation directory for Connext DDS. The default installation
paths are:
For UNIX-based systems: /home/your user name/rti_connext_dds-version
For Windows systems: C:\Program Files\rti_connext_dds-version
When you see  in the documentation, replace it with your installation
path.

❏ 
Examples are copied into your home directory the first time you run RTI Launcher or any
script in /bin. This document refers to the location of the copied examples as . The paths to the examples are:
For UNIX-based systems:
/home/your user name/rti_workspace/version/examples/
For Windows systems:
C:\Users\your user name\Documents\rti_workspace\version\examples\
When you see , replace it with the appropriate path.

4

Building the Test Applications
The example is in /connext_dds/c++/performance/throughput.
An example makefile is provided. For Windows systems, a sample Visual Studio project file is
provided instead. The data type for the test is in Throughput.idl.

2

Building the Test Applications

The source files are:

❏ ThroughputArgs.h, ThroughputArgs.cxx: Command-line argument parsing.
❏ TimeManager.h, TimeManager.cxx: Test duration control.
❏ PerfMon.h, PerfMon.cxx: On supported platforms, CPU and memory usage measurement.

❏ ThroughputQos.h, ThroughputQos.cxx: QoS settings for entities that are used in the
test.

❏ ThroughputTransport.h, ThroughputTransport.cxx: Transport configuration.
❏ ThroughputCommon.h, ThroughputCommon.cxx: Common utilities for both the publisher and subscriber.

❏ Throughput_publisher.cxx: Publisher application.
❏ Throughput_subscriber.cxx: Subscriber application.
Regardless of the platform, this test requires the following preprocessor defines, in addition to
the platform-specific defines described in the RTI Connext DDS Core Libraries Platform Notes:

❏ RTI_SHARED_MEMORY: Do not define this if your platform does not support shared
memory.

❏ RTI_IPV6: Do not define this if your platform does not support IPv6 transport. (Please
refer to the RTI Connext DDS Core Libraries Release Notes for information on using IPv6.)
The following sections provide more information about adding these defines.

4.1

Building the Test using the Makefile
1. A sample makefile is provided. To generate a makefile specific to your platform, use rtiddsgen with the -example flag, as follows:
/bin/rtiddsgen -example  -notypecode Throughput.idl

Since all the source files for this example are already present in the directory, rtiddsgen
may print messages saying that some files already exist and will not be replaced. You can
safely ignore these messages.
2. Remove the newly generated USER_QOS_PROFILES.xml file (its default profiles are
not consistent with the QoS used by the test).
3. In the generated makefile, add the preprocessor defines for shared memory and IPv6 to
the DEFINES_ARCH_SPECIFIC variable, if your platform supports those features:
DEFINES_ARCH_SPECIFIC = -DRTI_UNIX -DRTI_SHARED_MEMORY -DRTI_IPV6

4. Add the additional source files (ThroughputArgs.cxx, TimeManager.cxx, PerfMon.cxx,
ThroughputCommon.cxx, ThroughputQos.cxx, ThroughputTransport.cxx) to the
COMMMONSOURCES variable in the generated makefile:
COMMONSOURCES = Throughput.cxx ThroughputPlugin.cxx \
ThroughputSupport.cxx ThroughputArgs.cxx TimeManager.cxx \
PerfMon.cxx ThroughputCommon.cxx ThroughputQos.cxx \
ThroughputTransport.cxx

See the provided makefile as an example.
5. Set the NDDSHOME environment variable (for more information, see the RTI Connext
DDS Core Libraries Getting Started Guide).

3

6. Run this command to build:
gmake -f makefile_Throughput_

4.2

Building the Test on a Windows Systems using Visual Studio
1. On a Windows system, use rtiddsgen to generate a solution and project files for compiling
the throughput example:
\bin\rtiddsgen -example  -notypecode Throughput.idl

Since all the source files for this example are already present in the directory, rtiddsgen
may print messages saying that some files already exist and will not be replaced. You can
safely ignore these messages.
2. Remove the newly generated USER_QOS_PROFILES.xml file (its default profiles are
not consistent with the QoS used by the test).
3. Add the additional source files (ThroughputArgs.cxx, TimeManager.cxx, PerfMon.cxx,
ThroughputCommon.cxx, ThroughputQos.cxx, ThroughputTransport.cxx) to the publisher and subscriber projects.
• Select the files, and drag and drop them into the Source files folder in the publisher and subscriber projects.
• Alternatively in Visual Studio:
• Right-click the Source Files folder under the project.
• Select Add, Add Existing Item.
• Select the desired files.
4. Add the preprocessor definitions RTI_IPV6 and RTI_SHARED_MEMORY, if appropriate to your platform.
In Visual Studio:
• Right-click the project and select Properties.
• In the Properties window, select the C/C++, Preprocessor.
• Add the definitions to the Preprocessor definitions box (which should already
have some defines, such as RTI_WIN32).
5. For all architectures except Windows CE: we use the PDH library to measure CPU usage,
so please add pdh.lib as an additional link library.
6. Set the NDDSHOME environment variable (for more information, see the RTI Connext
DDS Core Libraries Getting Started Guide).
7. Build your project.

4.3

Special Note for VxWorks Users using Kernel Mode
If you will be running the test on VxWorks in kernel mode, please read the following:
Since this test runs in the same process as the kernel, there is no "main" function in the publisher
or subscriber. In addition, VxWorks has a limit of 10 command-line options, which precludes
you from running the entry point subscriber or publisher function directly. If the preprocessor
define, RTI_VXWORKS, is set: the publisher and subscriber are created with entry-point functions that optionally read the command-line parameters from a file. If no file is specified, the
defaults will be used.

4

Command-Line Options

To use this functionality, create a file readable by the VxWorks OS and put your desired command line in this file. An example configuration file for a publisher would look like this:
-domainId 88 -nic pub_IP -transport 1 -peer sub1_IP \
-subscribers 1 -duration 10 -size 1024 -demand 1000:1000:9000

(Where pub_IP is the publisher's IP address and sub1_IP is the subscriber's IP address.)
Now pass the entry-point function (subscriber_main for the subscriber, or publisher_main for
the publisher) the complete path to the configuration file as the only parameter.
On VxWorks 6.x systems, there is a known bug in the VxWorks kernel that manifests itself as a
"memPartFree" error if the sequence of calls fopen-fread-fclose is encountered. This sequence of
calls is used when reading in configuration parameters from a configuration file. If you encounter this problem, please hard-code the configuration parameters in the source files for the publisher and subscriber.
If you plan to run both the Throughput publisher and subscriber as Kernel tasks on the same
VxWorks target to test loopback or shared memory, you should use dynamic linking to avoid
symbol conflicts. More generally, dynamic linking should be used every time you run 2 or more
DDS applications as Kernel tasks of the same VxWorks target.

4.4

Special Note for VxWorks Users using RTP Mode
If you will be running in RTP mode, the test runs in a separate process from the kernel and thus
has a regular "main" function. None of the above limitations exist for RTP mode processes.
There is no high-resolution clock available for VxWorks in RTP mode, so the delay measurements cannot be as accurate as in Kernel mode. Therefore, the rate calculations provided by the
Throughput test may not be as accurate as they would be in Kernel mode.

5

Command-Line Options
All options are preceded by the minus sign (-). Some take additional information where
required. Test output can be captured using redirection on the command line.
All parameters are optional; the defaults can be found in the main function (wmain for WinCE,
vx_publisher_main and vx_subscriber_main for VxWorks Kernel mode).
For examples, please see Example Command Line Arguments (Section 6).

Table 5.1

Command-Line Options

Option
-domainId #

Publishing Application

Subscribing Application

Sets the domain ID. Note that this test can be run at the same time as other
Connext DDS applications, provided that the domain ID is unique.
Sets the participant ID number.

-participantId #

Use a unique value for each application running on the same host that uses the
same domain ID.
Publishing Application’s Default: 0
Subscribing Application’s Default: 1

5

Table 5.1

Command-Line Options

Option

Publishing Application

Subscribing Application

Restricts Connext DDS to sending output through this interface. This can be the
IP address of any available network interface on the machine.
-nic 

-transport #

By default, Connext DDS will attempt to contact all possible subscribing nodes on
all available network interfaces. While this may be interesting for some users, we
are focusing on a simple case. Even on a multi-NIC machine, the performance
over one NIC vs. another may be different (e.g., Gbit vs. 100 Mbit), so choosing
the correct NIC is critical for a proper test.
Determines which transport to use for the test:
1 = UDP over IPv4
2 = Shared Memory
8 = UDP over IPv6
Specifies each peer taking part in the test.

For the publishing application, specify the IP address or hostname of each
subscribing application. If all subscribing applications are on the same remote
host, you will only need to specify that one hostname. If each subscribing
application is on a separate host, specify each one individually. If the publishing
and subscribing applications are on the same host, specify that you are using
-peer 
For the subscribing application, just specify the IP address or hostname of the
or
publishing application.
-peer shmem://
You can specify up to 16 peers; to change this limit, modify the #definition of
MAX_TEST_SUBSCRIBERS in ThroughputCommon.h.
When performing the test with two or more subscribing applications, the subscribers flag (on the publishing side) and the
-participantId flag (on both the publishing and subscribing sides) are both
mandatory.
-reliable
-mcast_recv_addr


6

Instructs the test to use reliable communication. By default, the test uses besteffort communication.
N/A

Sets the multicast address to use for
receiving data.

Example Command Line Arguments

Table 5.1

Command-Line Options

Option

Publishing Application

-subscribers #

Sets the number of subscribing
applications that are participating in
the test. There may be more than one
subscribing application (participant)
on each node.

-duration #

Sets the number of seconds to be
sustained for each demand run.

-size #

Sets the payload size.

-demand
:
:


Controls how many samples the
publisher should write consecutively
between 10ms sleep periods.

Specifies how long to sleep after
-recoveryTime 

Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : Yes
Author                          : adelle
Create Date                     : 2016:03:24 10:28:13Z
Modify Date                     : 2016:03:24 10:31:16Z
XMP Toolkit                     : Adobe XMP Core 5.2-c001 63.139439, 2010/09/27-13:37:26
Creator Tool                    : FrameMaker 10.0.2
Producer                        : Acrobat Elements 10.0.0 (Windows)
Format                          : application/pdf
Title                           : CppThroughputBook.book
Creator                         : adelle
Document ID                     : uuid:e4072760-d418-4b83-8e72-a5b5937d2146
Instance ID                     : uuid:72d2f19e-4fb9-4a3f-8323-d2a51bf0ac1a
Page Mode                       : UseOutlines
Page Count                      : 14
EXIF Metadata provided by EXIF.tools

Navigation menu