Home

RTI® Data Distribution Service

image

Contents

1. 5 2 1 1 Implementation The C code to create a ContentFilteredTopic looks like this see NewsSubscriber cpp DDSContentFilteredTopic cft CH participant gt create_contentfilteredtopic cftName c_str topic contentFilterExpression c_str noFilterParams if efe NULL throw std runtime_error Unable to create ContentFilteredTopic The Topic and ContentFilteredTopic classes share a base class TopicDescription The corresponding code in Java looks like the following see NewsSubscriber java ContentFilteredTopic cft participant create_contentfilteredtopic Java topic get_name filtered o topic contentFilterExpression null Wie ere mo 4 throw new IllegalStateException Unable to create ContentFilteredTopic The variable contentFilterExpression in the above example code is an SQL expression specified on the command line see immediately below 5 2 1 2 Running amp Verifying The following shows a simple filter with which the subscribing application indicates it is interested only in news articles from CNN you can specify such a filter with the f or filterExpression command line argument like this in the Java example gt run sh sub f key CNN OR key Reuters This example uses the built in KeyedString data type This type has two fields key a string field that is the type s only key field and value a second string This example uses the key
2. Lorem ipsum 9 9 50 14 AM From Bloomberg Lorem ipsum 2 From AP Lorem ipsum 5 9 50 14 AM From Reuters Lorem ipsum 6 From Bloomberg Lorem ipsum 3 9 50 14 AM From NY Times Lorem ipsum 2 Publishing Application Subscribing Application 5 3 5 2 5 2 1 5 4 Subscribing Only to Relevant Data From reading Chapter 3 you already understand how to subscribe only to the topics in which you re interested However depending on your application you may be inter ested in only a fraction of the data available on those topics Extraneous uninteresting or obsolete data puts a drain on your network and CPU resources and complicates your application logic Fortunately RTI Data Distribution Service can perform much of your filtering and data reduction for you Data reduction is a general term for discarding unnecessary or irrele vant data so that you can spend you time processing the data you care about You can define the set of data that is relevant to you based on I Its content Content based filters can examine any field in your data based on a variety of criteria such as whether numeric values meet various equality and inequality relationship or whether string values match certain regular expression patterns For example you may choose to distribute a stream of stock prices using a single topic but indicate that you re interested only in the price of IBM and only when that price go
3. lt batch gt lt datawriter_qos gt To force the DataWriter to send whatever data is currently stored in a batch use the DataWriter s flush operation 6 3 2 Running amp Verifying 1 To run and verify the new QoS parameters first run Hello_builtin using a sim ple reliable configuration batching is turned off Copy reliable xml from NDDSHOME example QoS to NDDSHOME example lt language gt Hello_builtin and rename it to USER_QOS_PROFILES xml Observe the results Figure 6 5 Initial Performance Results c DOS run sub 6 12 Streaming Data over Unreliable Network Connections Figure 6 6 2 Next run the example again with a configuration that includes batching Copy high_throughput xml from NDDSHOME example QoS to NDDSHOME example lt language gt Hello_builtin and rename it to USER_QOS_PROFILES xml 3 Run Hello_builtin again Verify that the throughput numbers have improved Improved Performance Results e DOS run sub olx 6 4 Streaming Data over Unreliable Network Connections Systems face unique challenges when sending data over lossy networks that also have high latency and low bandwidth constraints for example satellite and long range radio links While sending data over such a connection a middleware tuned for a high speed dedicated Gigabit connection would throttle unexpectedly cause unwanted tim eouts and retransmissions and ultimately suffer severe performance d
4. lt element gt lt name gt dds transport UDPv4 builtin parent message_size_ max lt name gt lt value gt 1500 lt value gt lt element gt lt value gt lt property gt lt participant_qos gt The DomainParticipant s dds transport UDPv4 builtin parent message_size_max prop erty sets the maximum size of a datagram that will be sent by the UDP IPv4 transport If your application interfaces to your network over a transport other than UDP IPv4 the name of this property will be different In this case it is limiting all datagrams to the Streaming Data over Unreliable Network Connections MTU of the link assumed for the sake of this example to be equal to the MTU of Ether net At the same time the DataWriter is configured to send its samples on the network not synchronously when write is called but in a middleware thread This thread will flow datagrams onto the network at a rate determined by the FlowController identi fied by the flow_controller_name In this case the flow controller is a built in instance that allows all data to be sent immediately In a real world application you may want to use a custom FlowController that you create and configure in your application code Further information on this topic is beyond the scope of this example For more infor mation on asynchronous publishing see Section 6 4 1 in the RTI Data Distribution Service User s Manual You can also find code examples demonstrating t
5. Section 5 2 wouldn t it be nice if you could take advantage of the middleware s own data cache rather than implementing your own You can Caching Data Within the Middleware 5 4 1 When a DataReader reads data from the network it places the samples in order into its internal cache When you re ready to view that data either because you received a noti fication that it was available or because you decided to poll you use one of two fami lies of methods I take Read the data from the cache and simultaneously remove it from that cache Future access to that DataReader s cache will not see any data that was pre viously taken from the cache This behavior is similar to the behavior of receive methods provided by traditional messaging middleware implementa tions L read Read the data from the cache but leave it in the cache so that it can poten tially be read again subject to any lifespan or history depth you may have speci fied The News example uses this method When you read or take data from a DataReader you can indicate that you wish to access all of the data in the cache all up to a certain maximum number of samples all of the new samples that you have never read before and or various other qualifiers If your topic is keyed you can choose to access the samples of all instances at once or you can read take one instance at a time For more information about keys and instances see Section 2 2 2 Sam
6. Type Safe Data Programming with Data Types 4 3 2 2 where language is one of C C C CLI C or Java and architecture is one of the supported RTI architecture names such as i86Linux2 6gcc3 4 3 for Red Hat Enterprise Linux 4 For example gt rtiddsgen ppDisable language C example i86Win32VS2005 MyTypeDefinitions idl See Section 3 7 Using rtiddsgen in the User s Manual for more information Registering Data Types If you look in the file Hello cxx you will see that it creates a DomainParticipant just like the previous examples participant DDSDomainParticipantFactory get_instance gt create_participant arg domaintid DDS_PARTICIPANT QOS DEFAULT NULL Listener DDS_STATUS_MASK_ NONE It then makes one additional call DDS_ReturnCode_t rc HelloWorldTypeSupport register_type participant HelloWorldTypeSupport get_type_name The class HelloWorldTypeSupport is part of the code generated by rtiddsgen Register ing that type makes it known to the DomainParticipant so that it will know how to serial ize and deserialize data of that type when you publish or subscribe to it The most important part of the registration is the name by which you register the type you will use that name later when you create a Topic In this case we choose to register the type under its default name the name HelloWorld defined in the IDL file This is the string returned by Hell
7. You should see output like the following from the subscribing application Compact Type Safe Data Programming with Data Types gt objs i86Linux2 6gcc3 4 3 Hello sub domain 13 Hello Example Application Copyright 2 8 Real Time Innovations Inc Sec from Total ITotal Lost iCurr Lost Average Current IThroughput start samples I samples I samples IsmpLs sec Ismpls sec IMbps vonon C aada aaas aaa aaa aaas aaa 1 3984 3984 00 3984 00 31 09 2 8112 4056 00 4128 00 32 22 3 12096 4032 00 3984 00 31 09 4 16128 4032 00 4032 00 31 47 5 20112 J 4022 40 3984 00 31 09 6 24144 4024 00 4032 00 31 47 T 28176 4025 14 4032 00 31 47 8 32160 o 4020 00 3984 00 31 09 9 36432 4048 00 4272 00 33 34 10 40800 o 4080 00 4368 00 34 09 11 45168 4106 18 4368 00 34 09 12 49536 J 4128 00 4368 00 34 09 13 53904 4146 46 4368 00 34 09 14 58272 4162 29 4368 00 34 09 15 62304 4153 68 4032 00 31 47 16 66288 4143 09 3984 08 31 09 17 70320 o 4136 47 4032 00 31 47 Next try the other provided QoS profiles and see how your results change Understanding the Performance Results You will see several columns in the subscriber side output L Seconds from start The number of seconds the subscribing application has been running It will print one line per second I Total samples The number of data samples that the subscribing application has received since it started running L Total lost sam
8. be sure it is pointing to the right copy of RTI Data Distribution Service Update your path Add RTI Data Distribution Service s scripts directory to your path This will allow you to run some of the simple command line utilities included in your distribu tion without typing the full path to the executable e On UNIX based systems Add the directory to your PATH environment vari able e On Windows systems Add the directory to your Path environment variable The installer gave you the option to set this environment variable automati cally as part of the installation process Make sure Java is available If you plan to develop in a language other than Java you do not need Java installed on your system and can safely skip this step Building and Running Hello World If you will be going through the examples in Java ensure that appropriate java and javac executables are on your path They can be found within the bin direc tory of your JDK installation The Release Notes list the Java versions that are sup ported On Linux systems Note that GNU java from the GNU Classpath project is not supported and will typically not work but is on the path by default on many Linux systems Make sure the preprocessor is available Check whether the C preprocessor e g cpp is in your search path This step is optional but makes code generation with the rtiddsgen utility more convenient Chapter 4 Capabilities an
9. run sh sub f key CNN OR key Reuters You will only see articles from CNN and Reuters and only the last value published for each as of the end of the two second polling period Now set the history depth to 10 and decrease the lifespan to three seconds With these settings and at the rates used by this example the lifespan will always take effect before the history depth Run the example again this time without a content filter Notice how the subscribing application sees all of the data that was publishing during the last two second period as well as the data that was published in the latter half of the previous period Reduce the lifespan again this time to one second If you run the example now you will see no cached articles at all Do you understand why The subscribing application s polling period is two seconds so by the time the next poll comes everything seen the previous time has expired Try changing the history depth and lifespan duration in the file USER_QOS_PROFILES xml to see how the example s output changes Time Based Filtering A time based filter allows you to specify a minimum separation between the data samples your subscribing application receives If data is published faster than this rate the mid dleware will discard the intervening samples Such a filter is most often used to down sample high rate periodic data see also Receiv ing Notifications When Data Delivery Is Late Section 5 5 but it
10. 15 Available articles as of 10 02 52 AM Lorem ipsum 1 cached Lorem ipsum 2 cached Lorem ipsum 3 cached lorem ipsum 4 cached Lorem ipsum 5 cached lorem ipsum 16 lorem ipsun 6 Lorem ipsua 17 Lorem ipsum 18 lorem ipsum 19 lorem ipsun 7 loren ipsum 20 lorem ipsum 21 loren ipsum 22 lorem ipsum 8 lorem ipsum 23 lorem ipsum 24 Lorem ipsum 25 lorem ipsua 9 lorem ipsum 4 cached Lorem ipsum 5 cached lorem ipsum 6 cached 10 02 50 AM From ONN 10 02 51 AM From Reuters 10 02 51 AM From Reuters 10 02 51 AM From Reuters 10 02 51 AM From ONN 10 02 51 AM From Reuters 10 02 51 AM From Reuters 10 02 52 AM From Reuters 10 02 52 AM From ONN articles as of 10 02 54 AM 10 02 48 AM From ONN 10 02 49 AM From CNN 10 02 49 AM From CNN 10 02 50 AM From CNN 10 02 50 AM From CNN Lorem ipsum 7 cached from Reuters and CNN due to history depth 10 samples Lorem ipsun 3 cached 4 CNN articles 1 amp 2 expired due to lifespan 6 seconds 5 9 5 2 3 5 10 Next we will change the history depth and lifespan duration in the file USER_QOS_PROFILES xml to see how the example s output changes Set the history depth to one Run the example again with the content based filter shown here in the Java example gt
11. A listener and listener mask that indicate which events the application wishes to be notified of if any In this case the Topic s type is a simple string a type that is built into the middleware Let s see the same logic in Java Topic topic participant create_topic Hello World StringTypeSupport get_type_name DomainParticipant TOPIC_QOS_DEFAULT QoS ray SILL Listener StatusKind STATUS_MASK_NONE Keys and Samples The data values associated with a Topic can change over ime The diff lues of the Topi db i eee ae time The different values of the opic passed between appli analogous to a message in cations are called samples other publish subscribe An application may use a single Topic to carry data about middleware many objects For example a stock trading application may have a single topic Stock Price that it uses to communicate information about Apple Google Microsoft and many other companies Similarly a radar track management application may have a single topic Aircraft Position that carries data about many different airplanes and other vehicles These objects within a Topic are called instances For a specific data type you can select one or more fields within the data type to form a key A key is used to uniquely identify one instance of a Topic from another instance of the same Topic very much like how the primary key in a database table identifies one record or another Samples
12. Data Distribution Service and RTI Message Service you can concatenate both of them into the same file If your version of RTI Data Distribution Service is licensed managed the software will not operate without a properly installed license file 2 5 UOHDI D SU Z 2 2 2 2 2 3 2 3 2 6 Loading the License File Each time your RTI Data Distribution Service application starts it will look for the license file in the following locations until it finds a valid license 1 In your application s current working directory in a file called license dat 2 In the location specified in the environment variable RTI_LICENSE_FILE which you may set to point to the full path of the license file including the file name for example C RTI my_license_file dat 3 In the RTI Data Distribution Service installation in the file NDDSHOMEV license dat As RTI Data Distribution Service attempts to locate and read your license file you may depending on the terms of the license see a printed message with details about your license If the license file cannot be found or the license has expired your application may be unable to initialize RTI Data Distribution Service depending on the terms of the license If that is the case your application s call to DomainParticipantFac tory create_participant will return null preventing communication Adding or Removing License Management If you are using an RTI software distrib
13. Java and Net a NO_DATA result 5 17 jueWdo eAeqg pido 10 suleyog UBIsSeq S 5 4 2 5 5 5 18 RTI Data Distribution Service also offers additional variations on the read and take methods to allow you to view different slices of your data at a time LJ You can view one instance at a time with read_instance take_instance read_next_instance and take_next_instance Ll You can view a single sample at a time with read_next_sample and take_next_sample For more information about these and other variations see the online API documenta tion under Modules Subscription Module DataReader Support FooDataReader Running amp Verifying To see the difference between read and take semantics replace read with take the arguments are the same rebuild the example and run again You will see that cached is never printed because every sample will be removed from the cache as soon as it is viewed for the first time Receiving Notifications When Data Delivery Is Late Many applications expect data to be sent and received periodically or quasi periodi cally They typically expect at least one data sample to arrive during each period a fail ure of data to arrive may or may not indicate a serious problem but is probably something about which the application would like to receive notifications For example l A vehicle may report its current position to its home base every secon
14. Once published articles remain available for a period of time during which subscribing applications can repeatedly access them if they wish After that time has elapsed the middleware will automatically expire them from its internal cache This chapter describes Building and Running the Code Examples and includes the fol lowing design patterns I Subscribing Only to Relevant Data I Accessing Historical Data When Joining the Network 4 Caching Data Within the Middleware I Receiving Notifications When Data Delivery Is Late Next Chapter gt Chapter 6 Design Patterns for High Performance 5 1 jueWdojeAsq pido JO SsU1 HOd UBISEg S 5 1 5 2 Building and Running the Code Examples For each of the supported languages C C C and JAVA source code for the News example is located in the directory NDDSHOME example lt language gt News The examples perform these steps 1 Parse the command line arguments 2 Load the quality of service QoS file USER_QOS_PROFILES xml from the current working directory The middleware does this automatically you will not see code in the example to do this For more information on how to use QoS pro files see the chapter on Configuring QoS with XML in the RTI Data Distribution Service User s Manual 3 On the publishing side send news articles periodically 4 On the subscribing side receive these articles and print them out periodically The steps for compiling and
15. XML in the RTI Data Distribution Service User s Manual In the file USER_QOS_PROFILES xml you will see the following uncomment it to specify a time based filter lt lt time_based_filter gt lt minimum_separation gt lt sec gt 1 lt sec gt lt nanosec gt 1 lt nanosec gt lt minimum_separation gt lt time_based_filter gt lt deadline gt lt period gt lt sec gt 3 lt sec gt lt nanosec gt 0 lt nanosec gt lt period gt lt deadline gt SS At the same time we implement a time based filter we increase the deadline period See the accompanying comment in the XML file as well as the online API documenta tion for more information about using the Deadline and TimeBasedFilter QoS policies together 5 11 juowdojeaeg pido JO suleyog UBIseq S 5 2 3 2 Running amp Verifying Figure 5 4 shows some of the output after activating the filter Figure 5 4 Using a Time based Filter wee AM From Economist Loren ipsum 3 gt Ccached Article 1 sent at 31 cached cached lt Article 1 sent at 31 cached 2 om onom orem mi cached ins oz AM From Reuters Lorem ipsum 6 2 AM Article 6 sent at 32 cached Articles 2 5 filtered psum 4 cached Article 3 sent at 32 11 02 32 AM From CNN Lorem ipsum 3 cached lt Article 2 filtered Because you set the time based filter to one second you will not s
16. _reader return_loan articles articleInfos The read method takes several arguments L Data and Sampleinfo sequences The first two arguments to read or take are lists for the samples themselves and in parallel for meta data about those sam ples In most cases you will pass these collections into the middleware empty 5 16 Caching Data Within the Middleware and the middleware will fill them for you The objects it places into these sequences are loaned directly from the DataReader s cache in order to avoid unnecessary object allocations or copies When you are done with them call return_loan If you would rather read the samples into your own memory instead of taking a loan from the middleware simple pass in sequences in which the contents have already been deeply allocated The DataReader will copy over the state of the objects you provide to it instead of loaning you its own objects In this case you do not need to call return_loan L Number of samples to read If you are only prepared to read a certain number of samples at a time you can indicate that to the DataReader In most cases you will probably just use the constant LENGTH_UNLIMITED which indicates that you are prepared to handle as many samples as the DataReader has available L Sample state The sample state indicates whether or not an individual sample has been observed by a previous call to read The News example uses this state
17. application projects start with minimal networking needs So it s natural to consider whether building a simplified middleware in house is a better alternative to purchasing a more complex commercial middleware While doing a complete Return on Investment ROI analysis is outside the scope of this document with RTI Data Distribution Service you get a rich set of high performance networking features by just turning on configuration parameters and often without writing a single line of additional code RTI has decades of experience with hundreds of applications This effort created an integrated and time tested architecture that seamlessly provides the flexibility you need to succeed now and grow into the future Many features require fundamental support in the core of the middleware and cannot just be cobbled onto an existing framework It would take many man years of effort to duplicate even a small subset of the functionality to the same level of stability and reliability as delivered by RTI For example some of the middleware functionality that your application can get by just enabling configuration parameter include L Tuning reliable behavior for multicast lossy and high latency networks L Supporting high data availability by enabling redundant data sources for example keep receiving data from source A If source A stops publish ing then start receiving data from source B and providing notifications when application en
18. applications An introduction to meeting common real world requirements If you d like to skip to the next chapter click Installing RTI Data Distribution Service 1 1 QWOIIOM L 1 1 Why Choose RTI Data Distribution Service RTI Data Distribution Service implements publish subscribe networking for high perfor mance distributed applications It complies with the Data Distribution Service DDS standard from the Object Management Group OMG Developers familiar with JMS and other middleware will see similarities but will also find that DDS is not just another MOM message oriented middleware standard Its unique peer to peer architecture and unprecedented flexibility delivers much higher performance and adaptation to challenging applications DDS is the first truly real time networking technology stan dard RTI Data Distribution Service is by far the market leading implementation of DDS Reduce Risk Through Performance and Availability RTI Data Distribution Service provides top performance whether measured in terms of latency throughput or real time determinism One reason is its elegant peer to peer architecture Traditional messaging middleware requires dedicated servers to broker messages introducing throughput and latency bottlenecks and timing variations Brokers also increase system administration costs and represent single points of failure within a dis tributed application putting data reliability and avail
19. at least one data sample of each instance within a given period using the Deadline QoS policy See the example XML configuration above If the declared deadline period elapses since the DataReader received the last sample of some instance that reader s listener if any will be invoked The listener s on_requested_deadline_missed will receive a call informing the application of the missed deadline The following code installs a DataReaderListener in C ce DDSDataReader reader participant gt create_datareader TODE DDS_DATAREADER_QOS_DEFAULT amp _listener listener DDS_STATUS_MASK ALL all callbacks if reader NULL throw std runtime_error Unable to create DataReader The following code installs a DataReaderListener in Java DataReader reader participant create_datareader ECIOLG Subscriber DATAREADER_QOS_DEFAULT new ArticleDeliveryStatusListener listener StatusKind STATUS_ MASK ALL all callbacks if reader null throw new IllegalStateException Unable to create DataReader There are two listener related arguments to provide I Listener The listener object itself which must implement some subset of the call backs defined by the DataReaderListener supertype I Listener mask Which of the callbacks you d like to receive In most cases you will use one of the constants STATUS_MASK_ALL if you are providing a non null listener object of STATUS_MA
20. bridging application it will typically participate in only one domain and have only one DomainParticipant DomainParticipants are used to create Topics Publishers DataWriters Subscribers and DataReaders in the corresponding domain Figure 3 2 Segregating Applications with Domains 3 12 Node 1 App 1 Node 4 App 4 Pub Sub Domain0 Pub Sub Cmd Control Node 4 App 5 Node 2 App 2 Publish Subscribe Domain1 Status Node 3 App 3 Pub Sub Node 6 App 7 Pub Sub Node 5 App 6 Subscribe Node 7 App 8 Pub Sub Data Distribution Service DDS 101 The C Hello_simple example application contains the following code which instanti ates a DomainParticipant You can find more information about all of the APIs shown in the online documentation participant DDSDomainParticipantFactory get_instance gt create_participant OF Domain TD y DDS_PARTICIPANT_QOS_ DEFAULT QoS NULL Listener DDS_STATUS_MASK_NONE As you can see there are four pieces of information you supply when creating a new DomainParticipant L The ID of the domain to which it belongs LI Its qualities of service QoS The discussion on Page 3 14 gives a brief introduc tion to the concept of QoS in DDS you will learn more in Chapter 4 Capabilities and Performance Its listener and listener mask which indicate the events that will generate call backs to the DomainParticipant You will see a brief example o
21. can also be used to limit data rates for aperiodic but bursty data streams Time based filters have several applications LJ You can limit data update rates for applications in which rapid updates would be unnecessary or inappropriate For example a graphical user interface should typically not update itself more than a few times each second more frequent updates can cause flickering or make it difficult for a human operator to perceive the correct values Subscribing Only to Relevant Data 5 2 3 1 I You can reduce the CPU requirements for less capable subscribing machines to improve their performance If your data stream is reliable helping slow readers keep up can actually improve the effective throughput for all readers by prevent ing them from throttling the writer l In some cases you can reduce your network bandwidth utilization because the writer can transparently discard unwanted data before it is even sent on the net work Implementation Time based filters are specified using the TimeBasedFilter QoS policy It only applies to DataReaders For more information about this policy consult the online API documenta tion under Modules DDS API Reference Infrastructure QoS Policies You can specify the QoS policies either in your application code or in one or more XML files Both mechanisms are functionally equivalent the News example uses the XML mechanism For more information see the chapter on Configuring QoS with
22. defined for now we cover it in Chapter 3 of the RTI Data Distribution Service User s Manual For this example we will use the file NDDSHOME example JAVA Hello_idl src HelloWorld idl const long HELLODDS_MAX PAYLOAD SIZE 8192 const long HELLODDS_MAX STRING_SIZE 64 This custom structure contains an opaque buffer of maximum size 8Kb an unsigned long and a simple string max size 64 characters 2 struct HelloWorld string lt HELLODDS_MAX STRING_SIZE gt prefix long sample_id sequence lt octet HELLODDS_MAX PAYLOAD_SIZE gt payload Ie 4 13 SOUDUWO Od PUD s yi qodo vy 4 14 To generate data type support code You can build this example using the same commands shown in the previous chapter However if you look inside of the build script in the Hello_idl directory build sh for Java on UNIX based systems build cmd for Java on Windows systems make Make file lt architecture gt for C on UNIX based systems or win32 Hello lt architec ture gt vcproj for C on Windows systems you will see a line similar to this gt rtiddsgen ppDisable language Java package com rti hello idl HelloWorld idl This line invokes the code generator to create definitions of your data type in a target programming language Java in the example above including logic to serialize and deserialize instances of that type for transmission over the network For a complete list of the arguments
23. is described in Chapter 15 of the User s Manual Define a dynamic type programmatically at run time This method may be appropriate for applications with dynamic data description needs applications for which types change frequently or cannot be known ahead of time It allows you to use an API similar to those of Tibco Rendezvous or JMS MapMessage to manipulate messages without sacrificing efficiency It is described in Running with Dynamic Types Section 4 3 3 The following sections of this document describe each of these models Using Built in Types RTI Data Distribution Service provides a set of standard types that are built into the mid dleware These types can be used immediately The supported built in types are String KeyedString Octets and KeyedOctets On the Java and NET platforms the latter two types are called Bytes and KeyedBytes respectively the names are different but the 4 9 SOUDUWO Od PUD s yi qodo vy 4 10 data is compatible across languages String and KeyedStrings can be used to send variable length strings of single byte characters Octets and KeyedOctets can be used to send variable length arrays of bytes These built in types may be sufficient if your data type needs are simple If your data is more complex and highly structured or you want DDS to examine fields within the data for filtering or other purposes this option may not be appropriate and you will need to take additional steps to
24. lt deadline gt lt period gt lt sec gt 1 lt sec gt lt nanosec gt 0 lt nanosec gt lt period gt lt deadline gt Note that if you have a DataReader or DataWriter level deadline specified inside the file s datareader_qos or datawriter_gos elements respectively possibly because you previously modified the configuration in Section 5 2 3 it is overriding the topic level 5 2 juoWdojeAeq pidpy JO SUJ HOd uBIseg S configuration Be careful that you don t modify a deadline specification that will only be overridden later and not take effect You will see output similar to Figure 5 5 Figure 5 5 Using a Shorter Deadline 11 22 41 AM From AP Lorem ipsum 39 o 11 22 41 AM From Bloomberg Lorem ipsum 20 gt Callback requested deadline missed Economist gt Callback requested deadline missed NY Times gt Callback requested deadline missed Economist gt Callback requested deadline missed NY Times 0 Available articles as of 11 22 43 AM a 11 22 37 AM From CNN Lorem ipsum 20 cached w 11 22 38 AM From CNN Lorem ipsum 21 cached A 5 22 Chapter 6 Design Patterns for High Performance In this chapter you will learn how to implement some common performance oriented design patterns As you have learned one of the advantages to using RTI Data Distribu tion Service is that you can easily tune your application without changing its code sim ply by updating the XML based
25. n N SE 5 10 5 3 Accessing Historical Data When Joining the Network s ssssssssrrssssssssissstestesssesntnsssesene 5 12 SL ImplenentatioNans aea e E nin E E E E 5 13 5 3 2 Running amp Verifying cccccscceccsccaccsnsssssscnsectaasenesccsessetascsressteascstesscsacsatensrsesectssses 5 14 5 4 Caching Data Within the Middleware cccccccccssccscsescsesnsteeseseeneneseecenenesesesnseneseseeeees 5 14 HAA Implementations enisi E EE REE een Aa sates 5 15 DAZ Running Ge Veribyin gee css a E A E A A E R 5 18 5 5 Receiving Notifications When Data Delivery Is Late cccsecsccesteseseseeneeesesteteeneees 5 18 5 9 1 Implementation EE E R a 5 19 5 5 2 Running amp Verifying sis sisi sevcacssis cesiesstasstvesssraa iviscstescsaasessetes sepestens kasisi eaii a 5 21 6 Design Patterns for High Performance 6 1 6 2 6 3 6 4 Building and Running the Code Examples ccccccesessessescecesesesteneesesesteeesceneneseseaneneees 6 2 Reliable Messaging iinsert neiii esaeran aana atte EN a Raai 6 4 6 21 _Timpl menitationiscscsecrecccscacscaseictoacocsegavertieocssocsaccatest a e i E E E 6 6 High Throughput for Streaming Data ssessssssssississeeseesisstsstsnsesiesinnisntennestentennesseniereesnene 6 9 GSA Tmplementati Ofiss inina eiieeii shinee decks ai 6 11 6 3 2 AMMAN Ce VENIN E seirer iene E AEE NE E R 6 12 Streaming Data over Unreliable Network Connections se se sssssssssssrisrisresssssirniesrsseese 6 13 6 4 1 Im
26. of different instances have different values for the key Sam ples of same instance of a Topic have the same key Note that not all Topics have keys For Topics without keys there is only a single instance of that Topic Chapter 4 Capabilities and Performance In the previous chapter you learned the basic concepts in RTI Data Distribution Service and applied them to a simple Hello World application In this chapter you will learn more about some of the powerful and unique benefits of RTI Data Distribution Service I A rich set of functionality implemented for you by the middleware so that you don t have to build it into your application Most of this functionality including sophisticated data filtering and expiration support for durable historical data and built in support for periodic data and deadline enforcement can be defined partially or even completely in declarative quality of service QoS poli cies specified in an XML file allowing you to examine and update your applica tion s configuration without rebuilding or redeploying it See Customizing Behavior QoS Configuration Section 4 2 for more information about how to configure QoS policies Chapter 5 Design Patterns for Rapid Development describes how to reduce filter and cache data as well as other common func tional design patterns L Compact type safe data The unique and expressive data typing system built into RTI Data Distribution Service supports not only opaq
27. piggyback a heartbeat onto a data message if the middleware is configured to cache 10 samples for example and heartbeats_per_max_samples is set to 5 a heartbeat will be piggybacked unto every other sample If heartbeats_per_max_samples is set equal to max_samples this means that a heartbeat will be sent with each sample Make Sure Repair Packets Don t Exceed Bandwidth Limitation Applications can configure the maximum amount of data that a DataWriter will resend at a time using the max_bytes_per_nack_response parameter For example if a DataReader sends a negative acknowledgement NACK indicating that it missed 20 Streaming Data over Unreliable Network Connections 6 4 1 4 samples each 10 KB in size and max_bytes_per_nack_response is set to 100 KB the DataWriter will only send the first 10 samples The DataReader will have to NACK again to receive the remaining 10 samples In the following example we limit the number of bytes so that we will never send more data than a 256 Kb s 1 ms latency link can handle over one second lt datawriter_qos gt lt protocol gt lt rtps_reliable_ writer gt lt max_bytes_per_nack_response gt 28000 lt max_bytes_per_nack_response gt lt rtps_reliable_ writer gt lt protocol gt lt datawriter_qos gt Use Batching to Maximize Throughput for Small Samples If your application is sending data continuously consider batching small samples to decrease the per sample
28. running the program are similar to those described in Building and Running Hello World Section 3 1 As with the Hello World example Java users should use the build and run command scripts in the directory NDDSHOME example J AVA News Non Java Windows developers will find the necesssary Microsoft Visual Studio solution files in the subdirectory NDDSHOME example lt language gt News win32 Appropriate makefiles for building the C or C examples on UNIX platforms are located in the subdirectory NDDSHOME example lt language gt News make The News example combines the publisher and subscriber in a single program which is run from the NDDSHOME example lt language gt News directory with the argument pub or sub to select the desired behavior When running with default arguments you should see output similar to that shown in Figure 5 1 To see additional command line options run the program without any arguments Both the publishing application and the subscribing application operate in a periodic fashion l The publishing application writes articles from different news outlets at different rates Each of these articles is numbered consecutively with respect to its news outlet Every two seconds the publisher prints a summary of what it wrote in the previous period Building and Running the Code Examples L The subscribing application polls the cache of its DataReader every two seconds and prints the data it finds the
29. to decide whether or not to append cached to the data it prints out By pass ing a sample state mask to the DataReader you indicate whether you are inter ested in all samples only those samples you ve never seen before or only those samples you have seen before The most common value passed here is ANY_SAMPLE_STATE L View state The view state indicates whether the instance to which a sample belongs has been observed by a previous call to read or take By passing a view state mask to the DataReader you can indicate whether you re interested in all instances only those instances that you have never seen before NEW instances or only those instances that you have seen before NOT_NEW instances The most common value passed here is ANY_VIEW_STATE I Instance state The instance state indicates whether the instance to which a sam ple belongs is still alive ALIVE whether it has been disposed NOT_ALIVE_DISPOSED or whether the DataWriter has simply gone away or stopped writing it without disposing it NOT_ALIVE_NO_WRITERS The most common value passed here is ANY_INSTANCE_STATE For more infor mation about the DDS data lifecycle consult the RTI Data Distribution Service User s Manual and the online API documentation Unlike reading from a socket directly or calling receive in JMS a DDS read or take is non blocking the call returns immediately If no data was available to be read it will return in C and C or throw in
30. use compile time types see Using Types Defined at Compile Time Section 4 3 2 or dynamic types see Running with Dynamic Types Sec tion 4 3 3 You can find the source for the Hello java example in NDDSHOME example J AVA Hello_builtin src the equivalent source code in other supported languages is in NDDSHOME example lt language gt Hello_builtin src The program Hello java will performs these steps 1 Parse command line arguments 2 Check if the Quality of Service QoS file can be located The XML file that sets the Quality of Service QoS parameters is either loaded from the file USER_QOS_PROFILES xml in the current directory of the pro gram or from the environment variable NDDS_QOS_PROFILES For more information on how to use QoS profiles see the chapter on Configuring QoS with XML in the RTI Data Distribution Service User s Manual 3 On the publishing side send text strings as fast as possible prefixing each one with a serial number 4 On the subscribing side receive these strings keeping track of the highest num ber seen as well as other statistics Print these out periodically The steps for compiling and running the program are the same as mentioned in Build ing and Running Hello World Section 3 1 Run the publisher and subscriber from the NDDSHOME example lt language gt Hello_builtin directory using one of the QoS profiles provided in NDDSHOME example QoS as described in Step 2 above
31. 48 AM From Reuters Lorem ipsum 5 From Reuters Lorem ipsum 3 Available articles as of 10 02 50 AM From AP Lorem ipsum 2 10 02 47 AM From CNN Lorem ipsum 1 cached From Reuters Lorem ipsum 4 10 02 47 AM From CNN Lorem ipsum 2 cached From CNN Lorem ipsum 2 10 02 48 AM From Reuters Lorem ipsum 6 From Reuters Lorem ipsum 5 10 02 48 AM From Reuters Lorem ipsum 7 From AP Lorem ipsum 3 10 02 48 AM From CNN Lorem ipsum 3 From Bloomberg Lorem ipsum 2 10 02 48 AM From Reuters Lorem ipsum 8 From Reuters Lorem ipsum 6 10 02 48 AM From Reuters Lorem ipsum 9 From NY Times Lorem ipsum 2 10 02 49 AM From Reuters Lorem ipsum 10 From Reuters Lorem ipsum 7 10 02 49 AM From CNN Lorem ipsum 4 From AP Lorem ipsum 4 10 02 49 AM From Reuters Lorem ipsum 11 From CNN Lorem ipsum 3 10 02 49 AM From Reuters Lorem ipsum 12 From Economist Lorem ipsum 2 10 02 49 AM From Reuters Lorem ipsum 13 From Reuters Lorem ipsum 8 10 02 49 AM From CNN Lorem ipsum 5 From Reuters Lorem ipsum 9 10 02 49 AM From Reuters Lorem ipsum 14 From AP Lorem ipsum 5 10 02 50 AM From Reuters Lorem ipsum 15 From Bloomberg Lorem ipsum 3 J rvortooie articles as of 10 02 52 AM From Reuters Lorem ipsum 10 10 02 47 AM
32. DEFAULT QoS amp listener Listener DDS_DATA AVAILABLE STATUS As you can see each DataReader is tied to a single topic A DataReader will only receive data that was published on its Topic Here is the analogous code in Java StringDataReader dataReader Java StringDataReader participant create_datareader i ECIOGLE Subscriber DATAREADER_QOS_DEFAULT QoS new HelloSubscriber Listener StatusKind DATA_AVAILABLE_ STATUS 3 18 RTI Data Distribution Service provides multiple ways for you to access your data you can receive it asynchronously in a listener you can block your own thread waiting for it to arrive using a helper object called a WaitSet or you can poll in a non blocking fash ion This example uses the former mechanism and you will see that it passes a non NULL listener to the create_datareader method The listener mask DATA_AVAILABLE_STATUS indicates that the application is only interested in receiving notifications of newly arriving data Let s look at the callback implementation in C retcode string_reader gt take_next_sample ptr_sample LNO P if retcode DDS_RETCODE_NO_DATA No more samples break else if retcode DDS_RETCODE_OK cerr lt lt Unable to take data from data reader error lt lt retcode lt lt endl return The take_next_sample method retrieves a single data sample i e a message from the Data
33. DataWriter only promises to publish updates only once a second they will not be able to communicate Offered Deadlines A DataWriter promises to publish data at a certain rate by providing a finite value for the Deadline QoS policy either in source code or in one or more XML configuration files Both mechanisms are functionally equivalent the News example uses the latter mechanism For more information about this mechanism see the chapter on Configur ing QoS with XML in the RTI Data Distribution Service User s Manual The file USER_QOS_PROFILES xml contains the following Deadline QoS policy con figuration which applies to both DataWriters and DataReaders lt deadline gt lt period gt lt sec gt 2 lt sec gt lt nanosec gt 0 lt nanosec gt lt period gt lt deadline gt The DataWriter thus promises to publish at least one data sample of each instance every two seconds If a period of two seconds elapses from the time the DataWriter last sent a sample of a particular instance the writer s listener if one is installed will receive a callback to its on_offered_deadline_missed method The News example does not actually install a DataWriterListener See the section on requested deadlines below the DataWriterListener works in a way that s parallel to the DataReaderListener 5 19 JueWdo eAeg pidpy 10 SU1 HOd UBISEg S 5 5 1 2 Requested Deadlines The DataReader declares that it expects to receive
34. From CNN Lorem ipsum 1 cached From CNN Lorem ipsum 4 10 02 47 AM From CNN Lorem ipsum 2 cached From Reuters Lorem ipsum 11 10 02 48 AM From CNN Lorem ipsum 3 cached From AP Lorem ipsum 6 10 02 49 AM From CNN Lorem ipsum 4 cached From NY Times Lorem ipsum 3 10 02 49 AM From CNN Lorem ipsum 5 cached Articles published in Last period as of 10 02 51 AM 10 02 50 AM From Reuters Lorem ipsum 16 From Reuters Lorem ipsum 12 10 02 50 AM From CNN Lorem ipsum 6 Publishing Application Subscribing Application 5 2 2 Lifespan and History Depth One of the most common ways to reduce data is to indicate for how long a data sample remains valid once it has been sent You can indicate such a contract in one or both of two ways in terms of a number of samples to retain the history depth and the elapsed time period during which a sample should be retained the lifespan For example you may be interested in only the most recent data value the so called last values or in all data that has been sent during the last second 5 6 Subscribing Only to Relevant Data 5 2 2 1 5 2 2 1 1 The history depth and lifespan which can be specified declaratively with QoS policies see below apply both to durable historical data sent to late joining subscribing appli cations as well as to current subscribing applications For example suppose a su
35. From your command shell go to NDDSHOME example J AVA Hello_simple and type gt runSub sh C To start the subscribing application L On a Windows system From your command shell go to NDDSHOME example CPP Hello_simple and type gt objs lt architecture gt HelloSubscriber exe where lt architecture gt is one of the supported architectures see the contents of the win32 directory for a list of available architectures For example the Windows architecture name corresponding to 32 bit Visual Studio 2005 is i86Win32VS2005 L On a UNIX based system From your command shell go to NDDSHOME example CPP Hello_simple and type gt objs lt architecture gt HelloSubscriber where lt architecture gt is one of the supported architectures see the contents of the make directory for a list of available architectures For example the Linux archi tecture corresponding to Red Hat Enterprise Linux 5 is i86Linux2 6gcc4 1 1 3 1 4 Step 4 Start the Publisher RTI Data Distribution Service interoperates across all of the programming languages it supports so you can choose whether to run the publisher in the same language you chose for the subscriber or a different language 3 8 Building and Running Hello World Java To start the publishing application As described above you should have already set your path appropriately so that the example application can load the native libraries on which RTI Data Distributi
36. L Set the NDDS_DISCOVERY_PEERS environment variable to a comma sepa rated list of the names or addresses of all the hosts that need to discover each other e On Windows systems For example set NDDS_DISCOVERY_PEERS 3 builtin udpv4 mypeerhost1 4 builtin udpv4 mypeerhost2 1 To see if your platform supports RTI s multicast network transport see the RTI Data Distribution Service Platform Notes 2 To see if your platform supports RTI s shared memory transport see the RTI Data Distribution Service Platform Notes 4 3 SOUDUWO IOd PUD SeyIIIGodDd vy 4 2 4 4 e On UNIX based systems For example if you are using csh or tesh setenv NDDS_DISCOVERY_PEERS 3 builtin udpv4 mypeerhost1 4 builtin udpv4 mypeerhost2 l Set the discovery peer list in your XML QoS configuration file For example to turn on shared memory only lt participant_qos gt lt discovery gt The initial_peers list are those addresses to which the middleware will send discovery announcements gt lt initial_peers gt lt element gt 4 builtin shmem lt element gt lt initial_peers gt S The multicast_receive_addresses list identifies where the domain participant listens for multicast announcements from others Set this list to an empty value to disable listening over multicast gt lt multicast_receive_addresses gt lt empty gt lt multicast_receive_addresses gt lt discovery gt lt participant_q
37. Make sure you have GNU s version of the tar utility which handles long file names On Linux systems this is the default tar executable On Solaris systems use gtar 2 Create a directory for RTI Data Distribution Service We will assume that you want to install under opt rti you may replace references to opt rti with the direc tory of your choice 3 Move the downloaded file s into your newly created directory We assume your distribution file is named rtidds44x i86Linux2 6gcc3 4 3 tar gz Your filename will be different depending on your architecture 4 Extract the distribution from the uncompressed files For example gunzip rtidds44x i86Linux2 6gcc3 4 3 tar gz gtar xvf rtidds44x i86Linux2 6gcc3 4 3 tar Repeat this step as necessary if you have additional archive files The names of these files will differ based on the name of your target platform s Using our example path you will end up with opt rti ndds 4 4x Note If you have a license managed distribution of RTI Data Distribution Service the directory will be opt rti ndds 4 4x_lic Next read License Management Section 2 2 Installing RTI Data Distribution Service 2 1 2 1 Installing on a Windows System Depending on your needs and your license terms you may either have an installer or a two or more zip archives a host archive containing documentation header files and other things you need for development and one or more target archives contain
38. QOS_PROFILES xml before running your application Compact Type Safe Data Programming with Data Types How data is stored or laid out in memory can vary from language to language compiler to compiler operating system to operating system and processor to processor This combination of language compiler operating system processor is called a platform Any modern middleware must be able to take data from one specific platform say C gcc 3 2 2 Solaris Sparc and transparently deliver it to another for example Java JDK 1 6 Windows XP Pentium This process is commonly called serialization deserializa tion or marshalling demarshalling Messaging products have typically taken one of two approaches to this problem I Do nothing With this approach the middleware does not provide any help and user code must take into account memory layout differences when sending mes sages from one platform to another The middleware treats messages as an opaque buffer of bytes The JMS BytesMessage is an example of this approach L Send everything every time Self describing messages are at the opposite extreme and embed full reflective information including data types and field names with each message The JMS MapMessage and the messages in TIBCO Rendezvous are examples of this approach 4 7 SOUDUWO Od PUD SeyIIIGodDd vy The do nothing approach is lightweight on its surface but forces you the user of the middleware API to consider al
39. Quality of Service QoS parameters We will build on the examples used in Building and Running Hello World Section 3 1 to demonstrate the different use cases There are three example applications Hello_builtin Hello_idl and Hello_dynamic These examples provide the same func tionality but use different data types in order to help you understand the different type definition mechanisms offered by RTI Data Distribution Service and their tradeoffs They implement a simple throughput test the publisher sends a payload to the subscriber which periodically prints out some basic statistics You can use this simple test to quickly see the effects of your system design choices programming language target machines quality of service configurations and so on The QoS parameters do not depend on the language used for your application and sel dom on the operating system there are few key exceptions so you should be able to use the XML files with the example in the language of your choice This chapter includes l Building and Running the Code Examples I Reliable Messaging LJ High Throughput for Streaming Data I Streaming Data over Unreliable Network Connections 6 1 SOUDWIOLed YIH 10 SUI HOd UBIseg 9 6 1 6 2 Building and Running the Code Examples You can find the source for the Hello_builtin example for Java in NDDSHOME example JAVA Hello_builtin the equivalent source code in other supported languages i
40. RIT Data Distribution Service The Real Time Publish Subscribe Middleware Getting Started Guide Version 4 4 This Guide describes how to download and install RTI Data Distribution Service It also lays out the core value and concepts behind the product and takes you step by step through the creation of a simple example application Developers new to RTI should read this document 2009 Real Time Innovations Inc All rights reserved Printed in U S A First a RTI Trademarks Real Time Innovations and RTI are registered trademarks of Real Time Innovations Inc All other trademarks used in this document are the property of 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 Real Time 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 385 Moffett Park Drive Sunnyvale CA 94089 Phone 408 990 7444 Email support rti com Website http www rti com support Contents 1 Welcome to RTI Data Distribution Service 1 1 1 2 2 1 22 2 3 2 4 3 1 Why Choose RTI Data Distribution Service se sss
41. RTI Data Distribution Service You can also review the data from several performance benchmarks here http www tti com products dds benchmarks cpp linux html LJ Whitepapers and other articles These documents are available from http www tti com resources Of course RTI also offers excellent technical support and professional services To con tact technical support simply log into the portal send email to support rti com or con tact the telephone number provided for your region We thank you for your consideration and wish you success in meeting your distributed challenge 7 23 uolpjueuNnsog SIQDIIDAY Z
42. Reader one at a time without blocking If it was able to retrieve a sample it will return DDS_RETCODE_OK If there was no data to take it will return DDS_RETCODE_NO_DATA Finally if it tried to take data but failed to do so because it encountered a problem it will return DDS_RETCODE_ERROR or another DDS_ReturnCode_t value see the online documentation for a full list of error codes RTI Data Distribution Service can publish not only actual data to a Topic but also meta data indicating for example that an object about which the DataReader has been receiv ing data no longer exists In the latter case the info argument to take_next_sample will have its valid_data flag set to false This simple example is interested only in data samples not meta data so it only pro cesses valid data if info valid_data Valid this isn t just a lifecycle sample print it cout lt lt ptr_sample lt lt endl Data Distribution Service DDS 101 3 2 5 Let s see the same thing in Java eey String sample stringReader take_next_sample info if info valid_data System out println sample catch RETCODE_NO_DATA noData No more data to read break catch RETCODE_ERROR e An error occurred e printStackTrace Note that in this particular code example you will not find any reference to the Sub scriber class In fact as with Publishers creating the Subscriber object explicitly is
43. SK_NONE if you are not providing a lis tener There are some cases in which you might want to specify a different lis tener mask see the RTI Data Distribution Service User s Manual and online API documentation for more information 5 20 Receiving Notifications When Data Delivery Is Late The News example has a very simple implementation of the on_requested_deadline_missed callback It prints the value of the key i e the news outlet name for the instance whose deadline was missed Here is the code in C DDSDataReader reader const DDS _RequestedDeadlineMissedStatus amp status DS_KeyedString keyHolder DSKeyedStringDataReader typedReader DDSKeyedStringDataReader narrow reader typedReader gt get_key_value keyHolder status last_instance_handle std cout lt lt gt Callback requested deadline missed lt lt keyHolder key lt lt std endl fe void ArticleDeliveryStatusListener on_requested_deadline missed o IS Here is the corresponding code in Java Java public void on_requested_deadline_missed Jua Java DataReader reader RequestedDeadlineMissedStatus status KeyedString keyHolder new KeyedString reader get_key_value_untyped keyHolder status last_instance_handle System out println gt Callback requested deadline missed keyHolder key 5 5 2 Running amp Verifying Modify the file USER_QOS_PROFILES xml to decrease the deadline to one second
44. ability at risk RTI doesn t use brokers Messages flow directly from publishers to subscribers with minimal overhead All the functions of the broker including discovery finding data sources and sinks routing directing data flow and naming identifying data types and topics are handled in a fully distributed reliable fashion behind the scenes It requires no special server software or hardware Messaging Messaging Application Application Traditional message oriented middleware implementations require a broker to forward every message increasing latency and decreasing determinism and fault tolerance RTI s unique peer to peer architecture eliminates bottlenecks and single points of failure 1 For up to date performance benchmarks visit RTI on the web at http www rti com products dds benchmarks cpp linux html Why Choose RTI Data Distribution Service The design also delivers high reliability and availability with automatic failover config urable retries and support redundant publishers subscribers networks and more Publishers and subscribers can start in any order and enter and leave the network at any time the middleware will connect and disconnect them automatically RTI Data Dis tribution Service provides fine grained control over failure behavior and recovery as well as detailed status notifications to allow applications to react to situations such as missed delivery deadlines dropped connections an
45. also indicates the level of fault tolerance with which that data will be made available Learn more about durability including the RTI Persistence Service by reading the chapter on Mechanisms for Achieving Information Durability and Persistence in the RTI Data Distribution Service User s Manual Implementation To configure data durability use the Durability QoS policy on your DataReader and or DataWriter The degrees of durability described in Section 5 3 are represented as an enu merated durability kind For more information about this policy consult the online API documentation under Modules DDS API Reference Infrastructure QoS Policies You can specify the QoS policies either in your application code or in one or more XML files Both mechanisms are functionally equivalent the News example uses the XML 5 13 JueWdo eAeq pidpy 10 SUIO Dg UBISEg S 5 3 2 5 4 5 14 mechanism For more information see the chapter on Configuring QoS with XML in the RTI Data Distribution Service User s Manual In the file USER_QOS_PROFILES xml you will see the following lt durability gt lt kind gt TRANSIENT_LOCAL DURABILITY _QOS lt kind gt lt durability gt The above configuration indicates that the DataWriter should maintain data it has pub lished on behalf of later joining DataReaders and that DataReaders should expect to receive historical data when they join the network However if a DataWriter starts
46. ame gmake is used below Make sure that the GNU make binary is on your path before continuing Set Up the Environment on Your Deployment Machine Some configuration has to be done for the machine s on which you run your applica tion the RTI installer can t do that for you because those machines may or may not be the same as where you created and built the application a Make sure Java is available If you are a Java user see Step c in Section 3 1 1 1 for details Building and Running Hello World b Make sure the dynamic libraries are available Make sure that your application can load the RTI Data Distribution Service dynamic libraries If you use C or C with static libraries the default configura tion in the examples covered in this document you can skip this step However if you plan to use dynamic libraries or if you use Java or Net which always use dynamic libraries you will need to modify your environment as described here For more information about where Windows looks for dynamic libraries see http msdn microsoft com en us library ms682586 aspx e The dynamic libraries needed by C or C applications are in the directory NDDSHOME lib lt architecture gt On UNIX based systems Add this directory to your LD_LIBRARY_PATH environment variable On Windows systems Add this directory to your Path environment variable or copy the DLLs inside into the directory containing your executable e The n
47. ata Streaming Data over Unreliable Network Connections Figure 6 7 shows how an application s effective throughput as a percentage of the theo retical capacity of the link increases as the amount of data in each network packet increases To put this relationship in another way when transmitting a packet is expen sive it s advantageous to put as much data into it as possible However the trend reverses itself when the packet size becomes larger than the maximum transmission unit MTU of the physical network Figure 6 7 Example Throughput Results over VSat Connection E 5 je C g ao Mal o 100 10000 Data Length bytes Correlation between sample size and bandwidth usage for a satellite connection with 3 packet loss ratio To understand why this occurs remember that data is sent and received at the granular ity of application samples but dropped at the level of transport packets For example an IP datagram 10 KB in size must be fragmented into seven 1500 byte Ethernet frames and then reassembled on the receiving end the loss of any one of these frames will make reassembly impossible leading to an effective loss not of 1500 bytes but of over 10 thousand bytes On an enterprise class network or even over the Internet loss rates are very low and therefore these losses are manageable However when loss rates reach several percent the risk of losing at least one fragment in a large IP datagram becomes
48. ata loss by the physical transport such as wireless RF or Ethernet However there are data streams topics in which you want an absolute guaran tee that all data sent by a DataWriter is received reliably by DataReaders This means that the middleware must check whether or not data was received and repair any data that was lost by resending a copy of the data as many times as it takes for the DataReader to receive the data History Specifies how much data must be stored by the middleware for the DataWriter or DataReader This QoS policy affects the Reliability and Durability QoS policies When a DataWriter sends data or a DataReader receives data the data sent or received is stored in a cache whose contents are controlled by the History QosPolicy The History QosPolicy can tell the middleware to store all of the data that was sent or received or only store the last n values sent or received If the History QosPolicy is set to keep the last n values only then after n values have been sent or received any new data will overwrite the oldest data in the queue The queue thus acts like a circular buffer of length n This QoS policy interacts with the Reliability QosPolicy by controlling whether or not the middleware guarantees that a all of the data sent is received using the KEEP_ALL setting of the History QosPolicy or b that only the last n data values sent are received a reduced level of reliability using the KEEP_LAST set ting of t
49. ative acknowledgements NACK only reliability This feature is described in detail in the User s Manual Section 6 5 2 3 but is beyond the scope of this document 6 5 SOUDWWIOLed YIH 10 SUI HOd UBIsEg 9 6 2 1 6 2 1 1 6 6 Implementation There are many variables to consider and finding the optimum values to the queue size and the right policy for the buffers depends on the type of data being exchanged the rate of which the data is written the nature of the communication between nodes and various other factors The RTI Data Distribution Service User s Manual dedicates an entire chapter to the reli ability protocol providing details on choosing the correct values for the QoS based on the system configuration For more information refer to Chapter 10 in the User s Man ual The following sections highlight the key QoS settings needed to achieve strict reliability In the reliable xml QoS profile file you will find many other settings besides the ones described here A detailed description of these QoS is outside the scope of this docu ment and for further information refers to the comments in the QoS profile and in the RTI Data Distribution Service User s Manual Enable Reliable Communication The QoS that control the kind of communication is the Reliability QoS of the DataWriter and DataReader lt datawriter_qos gt lt reliability gt lt kind gt RELIABLE_ RELIABILITY _QOS lt kind gt lt max_blockin
50. ative dynamic libraries needed by Java applications are in the directory NDDSHOME lib lt architecture gt Your architecture name ends in jdk e g i86Linux2 6gcc3 4 3jdk The gcc part only present on UNIX based architec tures identifies the corresponding native architecture that relies on the same version of the C runtime library On UNIX based systems Add this directory to your LD_LIBRARY_PATH environment variable On Windows systems Add this directory to your Path environment variable e Java jar files are in the directory NDDSHOME class They will need to be on your application s class path e On Windows systems The dynamic libraries needed by Net applications are in the directory NDDSHOME lib i86Win32dotnet2 0 You will need to either copy the DLLs from that directory to the directory containing your exe cutable or add the directory containing the DLLs to your Path environment variable 1 The file nddsdotnet dll or nddsdotnetd dll for debug must be in the executable directory Visual Stu dio will by default do this automatically 3 5 PHOM OIISH 3 1 2 Step 2 Compile the Hello World Program Java on Windows Systems To build the example appli cations 1 From your command shell go to NDDSHOME example JAVA Hello_simple 2 Type gt build Java on UNIX based Systems To build the example applications 1 From your command shell go to NDDSHOME example JAVA Hello_s
51. bscrib ing application has set history depth 2 indicating that it is only interested in the last two samples A publishing application sends four data samples in close succession and the middleware on the subscribing side receives them before the application chooses to read them from the middleware When the subscribing application does eventually call DataReader read it will see only samples 3 and 4 samples 1 and 2 will already have been overwritten If an application specifies both a finite history depth and a finite lifespan whichever limit is reached first will take effect Implementation History depth is part of the History QoS policy The lifespan is specified with the Lifespan QoS policy The History QoS policy applies independently to both the DataReader and the DataWriter the values specified on both sides of the communication need not agree The Lifespan QoS policy is specified only on the DataWriter but it is enforced on both sides the DataReader will enforce the lifespan indicated by each DataWriter it discovers for each sample it receives from that DataWriter For more information about these policies consult the online API documentation under Modules DDS API Reference Infrastructure QoS Policies You can specify these QoS policies either in your application code or in one or more XML files Both mechanisms are functionally equivalent the News example uses the lat ter mechanism For more information about this mec
52. csccckcescesrscacsssasstcicaecs op stacsiuasertbcoadsopassegasorniaavelavasarsnaasos cust taceesh 3 20 4 Capabilities and Performance 41 lt Automatic Application DISCOVETY sccccccsstcciscecscecsscsssssecdasenssdbedessssidutedordscestsserdesecsudeedeuevtiens 4 2 4 1 1 When to Set the Discovery Peers sisniesississni iiien cesia ei 4 3 4 1 2 How to Set Your Discovery Pe fSuier tunari inhaa uri een EEEa 4 3 4 2 Customizing Behavior QoS Configuration cece cseseesesseseseesesesesesseeseseseeees 4 4 4 3 Compact Type Safe Data Programming with Data Types ccccccccecsteteesesesneteneees 4 7 4 3 1 Using Built in Types ccaccsccsscsescarcsscscecateastsesestssassisccnsssevsststsrvavestsssnnenesiarsneesesadias 4 9 4 3 2 Using Types Defined at Compile Time ccccccccsseseseeteteseseeseseeeeceenesesnanenenees 4 13 4 3 3 Running with Dynamic Types ccccccccsesescsseteseseecesescecenenesesnenesesescecesescsnanananens 4 16 5 Design Patterns for Rapid Development 5 1 Building and Running the Code Examples ccccccsscssesesescseseseseseecscssseseesecsssneseeesesaees 5 2 5 2 Subscribing Only to Relevant Data cceeeseeeecesessnesssssenesssessseneneseseseeeeees 5 4 5 2 1 Content Based Filtering cccccccccesccccessscstsnseseseecesesescensnssesesneesesceceenssesssneneneness 5 4 52 2 Lifespan and History Depth cccccccescesesseteeesecesesescenenssesesnesesceeecenenesesesneneneeees 5 6 5 2 9 Time Based Filtering sessies eeii
53. d I Each sensor in a sensor network reports a new reading every 0 5 seconds I A radar reports the position of each object that it s tracking every 0 2 seconds If any vehicle any sensor or any radar track fails to yield an update within its promised period another part of the system or perhaps its human operator may need to take a corrective action In addition to built in deadline support RTI Data Distribution Service has other features useful to applications that publish and or receive data periodically For example it s possible to down sample high rate periodic data see Subscribing Only to Relevant Data Section 5 2 Receiving Notifications When Data Delivery Is Late 5 5 1 5 5 1 1 Implementation Deadline enforcement is comprised of two parts 1 QoS policies that specify the dead line contracts and 2 listener callbacks to be notified if those contracts are violated Deadlines are enforced independently for DataWriters and DataReaders However the Deadline QoS policy like some other policies has request offer semantics the DataWriter must offer a level of service that is the same or better than the level of service the DataReader requests For example if a DataWriter promises to publish data at least once every second it will be able to communicate with a DataReader that expects to receive data at least once every two seconds However if the DataReader declares that it expects data twice a second and the
54. d Performance describes how to use rtiddsgen On Windows systems e If you have Microsoft Visual Studio installed Running the script vevars32 bat vsvars32 bat or vevarsall bat depending on your version of Visual Studio will update the path for a given command prompt If the Visual Studio installer did not add cl to your path already you can run this script before running rtiddsgen e If you do not have Microsoft Visual Studio installed This is often the case with Java users You can either choose not to use a preprocessor or to obtain a no cost version of Visual Studio from Microsoft s web site Get your project files ready If you installed RTI Data Distribution Service in a directory that is shared by mul tiple users for example in C Program Files on a Windows system or opt or local on a UNIX based system you may prefer to build and edit the examples in a directory of your own so you do not interfere with other users Depending on your file permissions you may have to copy them somewhere else If you would like copy the directory NDDSHOME example to a location of your choice Where you see NDDSHOME example mentioned in the instructions below substitute your own copied directory instead 3 3 PHOM OIISH 3 1 1 2 3 4 e On Windows systems If you chose to install RTI Data Distribution Service in C Program Files or another system directory Microsoft Visual Studio may present you with a warning m
55. d slow or unresponsive nodes The User s Manual has details on these and all other capabilities This guide only pro vides an overview Reduce Cost through Ease of Use and Simplified Deployment RTI Data Distribution Service helps keep development and deployment costs low by I Increasing developer productivity Easy to use standards compliant DDS APIs get your code running quickly DDS is the established middleware standard for real time publish subscribe communication in the defense industry and is expanding rapidly in utilities transportation intelligence finance and other commercial industries _J Simplifying deployment RTI Data Distribution Service automatically discovers connections so you don t need to configure or manage server machines or pro cesses This translates into faster turnaround and lower overhead for your deployment and administration needs L Reducing hardware costs Traditional messaging products require dedicated servers or acceleration hardware in order to host brokers The extreme efficiency and reduced overhead of RTI s implementation on the other hand allows you to achieve the same performance using standard off the shelf hardware with fewer machines than the competition Ensure Success with Unmatched Flexibility Out of the box RTI is configured to achieve simple data communications However when you need it RTI provides a high degree of fine grained low level control over the middleware inclu
56. ding LJ The volume of meta traffic sent to assure reliability L The frequencies and timeouts associated with all events within the middleware L The amount of memory consumed including the policies under which addi tional memory may be allocated by the middleware OWOIIOM L RTI s unique and powerful Quality of Service QoS policies can be specified in configu ration files so that they can be tested and validated independently of the application logic When not specified the middleware will use default values chosen to provide good performance for a wide range of applications The result is simple to use networking that can expand and adapt to challenging appli cations both current and future RTI eliminates what is perhaps the greatest risk of com mercial middleware outgrowing the capability or flexibility of the design Connect Heterogeneous Systems RTI Data Distribution Service provides complete functionality and industry leading per formance for a wide variety of programming languages and platforms including LI C C NET and Java development platforms LJ Windows Linux Solaris AIX and other enterprise class systems LJ VxWorks INTEGRITY LynxOS and other real time and or embedded systems Applications written in different programming languages running on different hard ware under different operating systems can interoperate seamlessly over RTI Distribu tion Service RTI can connect disparate applications
57. ducer promises to send updates at a minimum rate Consumers may then request data at that or any slower rate If a consumer requests a higher data rate than the producer offers the middleware will flag that pair as incompatible and notify both the publishing and subscribing applications L Producers may offer different levels of reliability characterized in part by the number of past data samples they store for retransmission Consumers may then request differing levels of reliable delivery ranging from fast but unreliable best effort to highly reliable in order delivery This provides per data stream reliability control A single producer can support consumers with different levels of reliability simultaneously Other QoS policies control when the middleware detects nodes that have failed set delivery order attach user data prioritize messages set resource utilization limits partition the system into namespaces control durability for fault tolerance and much more The DDS QoS policies offer unprecedented flexible communications control The RTI Data Distribution Service User s Manual contains details about all the QoS policies offered by DDS Data Distribution Service DDS 101 3 2 3 Publishers and DataWriters An application uses a DataWriter to dice rt into A A DDS DataWriter is domain Once a DataWriter is created and configured wit analogous to a JMS the correct QoS settings an application only needs to use TopicPublisher t
58. e documentation for the DataRead erProtocol and DataWriterProtocol QoS policies in the on line API documentation High Throughput for Streaming Data This design pattern is useful for systems that produce a large number of small messages at a high rate In such cases there is a small but measurable overhead in sending and in the case of reliable communication acknowledging each message separately on the network It is more efficient for the system to manage many samples together as a group referred to in the API as a batch and then send the entire group in a single network packet This allows RTI Data Distribution Service to minimize the overhead of building a datagram and traversing the network stack Batching increases throughput when writing small samples at a high rate As seen in Figure 6 2 throughput can be increased several fold much more closely approaching the physical limitations of the underlying network transport Figure 6 2 Benefits of Batching Mbit sec Max Throughput Mbps B Withoutbatching E 1Okbatches oo 2 6 128 25 512 1024 DE w 8192 Message Size bytes Batching delivers tremendous benefits for messages of small size 6 9 v upwoy d YBIH 10 sueyjog UBIseg 9 Figure 6 3 Benefits of Batching Sample Rates 6 10 1 500 000 1 250 000 1 000 000 750 000 500 000 Samples Per Second 250 000 0 200 400 600 800 1 000 Sample Size bytes A subset of the batched t
59. e for installation in the following forms depend ing on your needs and your license terms LI In a single package comprising both host development and target deployment files If you downloaded an evaluation of RTI Data Distribution Service from the RTI web site at no cost this is the distribution you have e For Windows users Your installation package is an executable installer application e For users of UNIX based systems Your installation package is a tar gz archive 2 1 UOHDI D SU Z 2 1 1 2 2 J In separate host and target packages This distribution is useful for those cus tomers who develop and deploy on different platforms or who deploy on multi ple platforms RTI also delivers support for embedded platforms this way To request access to additional RTI host or target platforms please contact your RTI account representative e For Windows users You have at least two zip archives one for your host platform and at least one target platform Expand them into the same directory a directory of your choice e For users of other operating systems You have at least two tar gz archives one for your host platform and at least one target platform Expand them into the same directory a directory of your choice Installing on a UNIX Based System The distribution is packaged in one or more tar gz files Unpack them as described below You do not need to be logged in as root during installation 1
60. e of the unique capabilities of RTI Data Distribution Ser vice strongly typed data QoS based customization of behavior and industry leading performance These examples are described in Chapter 4 Capabilities and Performance and Chapter 6 Design Patterns for High Performance L News This example demonstrates a subset of the rich functionality RTI Data Dis tribution Service offers including flexible support for historical and durable data built in data caching powerful filtering capabilities and tools for working with periodic data This example is described in Chapter 5 Design Patterns for Rapid Development 2 4 Selecting a Development Environment You can develop applications with RTI Data Distribution Service either by building and executing commands from a shell window or by using a development environment like Microsoft Visual Studio or Eclipse 2 4 1 Using the Command Line Tools on UNIX based Systems For Java based applications you can use the following script files to build and execute example JAVA lt example gt build sh Builds your Java source files no parame ters are needed L example JAVA lt example gt run sh Runs the main program in either Publisher or Subscriber mode It accepts the following parameters e pub sub Run as publisher or subscriber e verbose lIncreases output verbosity This script accepts other options which we will discuss in later chapters For C and C application
61. e using a QoS profile configured for strict reliability you can expect this column to always display 0 If you are running in best effort mode or in a limited reliability mode e g you have configured your History QoS policy to only keep the most recent sample you may see non zero values here k Current lost samples The number of samples that were lost in transit and could not be repaired since the last status line was printed See the description of the previous column for information about what values to expect here Average samples per second The mean number of data samples received per second since the subscribing application started running By default these exam ple applications send data samples that are 1 KB in size You can change this by passing a different size in bytes to the publishing application with size L Current samples per second The number of data samples received since the sub scribing application printed the last status line 6 3 SOUDWOLeg YIH 10 SUJOYDg UBISEg 9 6 2 6 4 Throughput megabits per second The throughput from the publishing applica tion to the subscribing application in bits per second since the subscribing application printed the previous status line The value in this column is equiva lent to the current samples per second multiplied by the number of bits in an individual sample With small sample sizes the fixed cost of traversing your operating system s n
62. ee more than two updates for any single news outlet in any given period because the period is two sec onds long 5 3 Accessing Historical Data When Joining the Network In Section 5 2 you learned how to specify which data on the network is of interest to your application The same QoS parameters can also apply to late joining subscribers applications that subscribe to a topic after some amount of data has already been pub lished on that topic This concept storing sent data within the middleware is referred to as durability You only need to indicate the degree of durability in which you re inter ested I Volatile Data is relevant to current subscribers only Once it has been acknowl edged if reliable communication has been turned on it can be removed from the service This level of durability is the default if you specify nothing you will get this behavior 5 12 Accessing Historical Data When Joining the Network 5 3 1 I Transient local Data that has been sent may be relevant to late joining subscrib ers subject to any history depth lifespan and content and or time based filters defined Historical data will be cached with the DataWriter that originally pro duced it Once that writer has been shut down for any reason intentionally or unintentionally however the data will no longer be available This lightweight level of durability is appropriate for non critical data streams without stringent data ava
63. egradation For example the transmission delay in satellite connections can be as much as 500 milli seconds to 1 second which makes such a connection unsuitable for applications or mid dleware tuned for low latency real time behavior In addition satellite links typically have lower bandwidth with near symmetric connection throughput of around 250 500 Kb s and an advertised loss of approximately 3 of network packets Of course the throughput numbers will vary based on the modem and the satellite service In light of SOUDWIOLed YIH 10 SUI HOd UBIsEg 9 6 4 1 6 4 1 1 6 14 these facts a distributed application needs to tune the middleware differently when sending data over such networks RTI Data Distribution Service is capable of maintaining liveliness and application level QoS even in the presence of sporadic connectivity and packet loss at the transport level an important benefit in mobile or otherwise unreliable networks It accomplishes this by implementing a reliable protocol that not only sequences and acknowledges applica tion level messages but also monitors the liveliness of the link Perhaps most impor tantly it allows your application to fine tune the behavior of this protocol to match the characteristics of your network Without this latter capability communication parame ters optimized for more performant networks could cause communication to break down or experience unacceptable blocking times a common
64. es above 20 I How old it is You can indicate that data is relevant for only a certain period of time its lifespan and or that you wish to retain only a certain number of data samples a history depth For example if you are interested in the last ten articles from each news outlet you can set the history depth to 10 L How fast it s updated Sometimes data streams represent the state of a moving or changing object for example an application may publish the position of a mov ing vehicle or the changing price of a certain financial instrument Subscribing applications may only be able to or interested in processing this data at a cer tain maximum rate For example if the changing state is to be plotted in a user interface a human viewer is unlikely to be able to process more than a couple of changes per second If the application attempts to process updates any faster it will only confuse the viewer and consume resources unnecessarily Content Based Filtering A DataReader can filter incoming data by subscribing not to a given Topic itself but to a ContentFilteredTopic that associates the Topic with an SQL like expression that indicates which data samples are of interest to the subscribing application Each subscribing application can specify its own content based filter as it desires publishing applica tions code does not need to change to allow subscribers to filter on data contents Subscribing Only to Relevant Data
65. es how many historical samples to retain lt datawriter_qos gt lt history gt lt kind gt KEEP_ALL_ HISTORY_QOS lt kind gt lt history gt lt datawriter_qos gt lt datareader_qos gt lt history gt lt kind gt KEEP_ALL_ HISTORY_QOS lt kind gt lt history gt lt datareader_qos gt The above section of the QoS profile tells RTI to use the policy KEEP_ALL for both DataReader and DataWriter 6 7 SOUDWOLed YIH 10 SUI HOd UBIsEg 9 6 2 1 3 6 8 Controlling Middleware Resources With the ResourceLimits QosPolicy you have full control over the amount of memory used by the middleware In the example below we specify that both the reader and writer will store up to 10 samples if you use a History kind of KEEP_LAST the values specified here must be consistent with the value specified in the History s depth lt datawriter_qos gt lt resource_limits gt lt max_samples gt 10 lt max_samples gt lt resource_limits gt lt datawriter_qos gt lt datareader_qos gt lt resource_limits gt lt max_samples gt 2 lt max_samples gt lt resource_limits gt lt datareader_qos gt The above section tells RTI to allocate a buffer of 10 samples for the DataWriter and 2 for the DataReader If you do not specify any value for max_samples the default behavior is for the middleware to allocate as much space as it needs One important function of the Resource Limits policy when used in conjuncti
66. eseey 2 8 2 4 1 Using the Command Line Tools on UNIX based Systems ccccssseeeeteees 2 8 2 4 2 Using the Command Line Tools on Windows Systems cccesseeseesesesseesesens 2 9 2 4 3 Using Microsoft Visual Studio cece rision arin 2 9 Getting Started with RTI Data Distribution Service Building and Running Hello World ccc cseeseeeececseseseesesesseesesesesesseeseseeeeeeees 3 1 3 1 1 Step 1 Set Up the Environment c ccccccsesscsscssscesessensssesesscessesssencaceeesessneaesnenesescenes 3 2 3 1 2 Step 2 Compile the Hello World Program cccceeseeseessessesesesessseseseseseeeescsens 3 6 3 13 Step S Start the Subscriber sas scisscsccssisssccscstinsecseevsinssesscsssasaatesessacnatacesatisats censeesban sees 3 8 3 14 Step 4 Start the Publisher c cccccccccsccseuesssssscscssvsscencvssusseetdessusssabesscasvanresncsersareenes 3 8 3 2 Data Distribution Service DDS 101 ienesis anaE AS 3 10 3 2 1 An Overview of DDS ODjects i aiisrissrssiciit aieri i ie eun e ia 3 11 32 2 DomainParticipants cccceccccesesecseseseseseeesseseseeeesesesesseeceescsesenssseesseneeesesaseenseseeses 3 11 3 2 3 Publishers and DataWriter cccccccccssscssecessecssecessecessecsececseessecaeecsseseneesaeeesnees 3 15 3 2 4 Subscribers and DataReaders cccccccccessccsscessecssscesseesssessecessecessecsacecsecseseesaeeeenees 3 16 3 2 9 TOPICS soeren eene ere Derre EEES EE a E E E E EEA EE r E 3 19 3 26 Keys and Samplesiss c
67. essage when you open a solution file from the installation directory If you see this dialog you may want to copy the example directory somewhere else as described above Security Warning for Hello The Hello project file has been customized and could present a security risk by executing custom build steps when opened in Microsoft Visual Studio If this project came From an untrustworthy source it could cause damage to your computer or compromise your private information More Details Project load options Opens the project in Microsoft Visual Studio with increased security This option allaws you to browse the contents of the project but some functionality such as Intellisense is restricted When a project is loaded for browsing actions such as building cleaning publishing or opening designers could still remain unsafe O Load project normally Opens the project normally in Microsoft Visual Studio Use this option if you trust the source and understand the potential risks involved Microsoft Visual Studio does not restrict any project Functionality and will not prompt you again for this project M Ask me for every project in this solution e On UNIX based systems The makefiles that RTI provides with the example code are intended to be used with the GNU distribution of the make util ity On modern Linux systems the make binary typically is GNU make On other systems GNU make is called gmake For the same of clarity the n
68. etwork stack is greater than the cost of actually transmitting the data as you increase the sample size you will see the throughput more closely approach the theoretical throughput of your network By batching multiple data samples into a single network packet as the high throughput example QoS profile does you should be able to saturate a gigabit Ethernet network with samples sizes as small as 100 200 bytes Without batching samples you should be able to saturate the network with samples of a few kilo bytes The difference is due to the performance limitations of the network trans port enterprise class platforms with commodity Ethernet interfaces can typically execute tens of thousands of send s per second In contrast saturating a high throughput network link with data sizes of less than a kilobyte requires hundreds of thousands of samples per second Is this the best possible performance The performance of an application depends heavily on the operating system the net work and how it configures and uses the middleware This example is just a starting point tuning is important for a production application RTI can help you get the most out of your platform and the middleware To get a sense for how an application s behavior changes with different QoS contracts try the other provided example QoS profiles and see how the printed results change Reliable Messaging Packets sent by a middleware may be lost by the physical ne
69. expected elapsed time between arriving data samples For a DataWriter it specifies a commitment to publish samples with no greater than this elapsed time between them Compact Type Safe Data Programming with Data Types 4 3 This policy can be used during system integration to ensure that applications have been coded to meet design specifications It can be used during run time to detect when systems are performing outside of design specifications Receiving applications can take appropriate actions to prevent total system failure when data is not received in time For topics on which data is not expected to be peri odic the deadline period should be set to an infinite value You can specify an object s QoS two ways a programmatically in your application s source code or b in an XML configuration file The same parameters are available regardless of which way you choose For complete information about all of the policies available see Chapter 4 in the RTI Data Distribution Service User s Manual or see the online documentation The examples covered in this document are intended to be configured with XML files You can find several example configurations called profiles in the directory NDDSHOME example QoS The easiest way to use one of these profile files is to either set the environment variable NDDS_QOS_PROFILES to the path of the file you want or copy that file into your current working directory with the file name USER_
70. f a listener callback when we discuss DataReaders below For a more comprehensive discussion of the DDS status and notification system see Chapter 4 in the User s Manual Here is the same logic in Java participant DomainParticipantFactory get_instance create_participant 0 Domain ID DomainParticipantFactory PARTICIPANT QOS_DEFAULT null Listener StatusKind STATUS_MASK_NONE 3 13 PHOM OII H E What is QoS Fine control over Quality of Service QoS is perhaps the most important feature of RTI Data Distribution Service Each data producer consumer pair can establish independent quality of service QoS agreements even in many to many topologies This allows DDS designs to support extremely complex and flexible data flow requirements QoS policies control virtually every aspect of the DDS model and the underlying communications mechanisms Many QoS policies are implemented as contracts between data producers DataWriters and consumers DataReaders producers offer and consumers request levels of service The middleware is responsible for determining if the offer can satisfy the request thereby establishing the communication or indicating an incompatibility error Ensuring that participants meet the level of service contracts guarantees predictable operation For example I Periodic producers can indicate the speed at which they can publish by offering guaranteed update deadlines By setting a deadline a pro
71. fespan gt Running amp Verifying The News example never takes samples from the middleware it only reads samples so data samples that have already been viewed by the subscribing application remain in the middleware s internal cache until they are expired by their history depth or lifespan duration contract These previously viewed samples are displayed by the subscribing application as cached to make them easy to spot See how CNN articles are expired It s important to understand that the data type used by this example is keyed on the name of the news outlet and that the history depth is databases the key of a DDS Topic is like enforced on a per instance basis You can see the the primary key of a database table effect in Figure 5 3 even though Reuters pub and the instance corresponding to that lishes articles faster than CNN the Reuters arti key is like the table row corresponding cles do not starve out the CNN articles each to that primary key outlet gets its own depth samples Figure 5 3 only shows articles from CNN and Reuters because that makes it easier to fit more data on the page If you run the example without a content filter you will see the same effect across all news outlets Remember that there is a strong analogy between DDS and relational Subscribing Only to Relevant Data Figure 5 3 Using History and Lifespan Available articles as of 10 02 48 AM Available 10 02 47 AM From Reuter
72. field to store the news outlet name and the value field to store the article text The word key in the content filter expression key CNN refers to the field s jueWdo eAeq pidpy 10 SU1 HOd UBISEg S name not the fact that it is a key field you can also filter on the value field if you like In your own data types you will use the name s of the fields you define You can find more detailed information in the online API documentation under Mod ules DDS API Reference Queries and Filters Syntax Figure 5 2 Using a Content based Filter OOO Te OOO Terminal ssh 60x45 gt run sh pub d 13 gt run sh sub d 13 f key CNN OR key Reuters P News Example Application News Example Application Copyright 2009 Real Time Innovations Inc Copyright 2009 Real Time Innovations Inc Articles published in Last period as of 10 02 49 AM Available articles as of 10 02 48 AM From Reuters Lorem ipsum 1 10 02 47 AM From Reuters Lorem ipsum 1 From AP Lorem ipsum 1 10 02 47 AM From CNN Lorem ipsum 1 From CNN Lorem ipsum 1 10 02 47 AM From Reuters Lorem ipsum 2 From Bloomberg Lorem ipsum 1 10 02 47 AM From Reuters Lorem ipsum 3 From NY Times Lorem ipsum 1 10 02 47 AM From Reuters Lorem ipsum 4 From Economist Lorem ipsum 1 10 02 47 AM From CNN Lorem ipsum 2 From Reuters Lorem ipsum 2 10 02
73. g_time gt lt sec gt 5 lt sec gt lt nanosec gt 0 lt nanosec gt lt max_blocking_time lt reliability gt lt datawriter_qos gt lt datareader_qos gt lt reliability gt lt kind gt RELIABLE_ RELIABILITY _QOS lt kind gt lt reliability gt lt datareader_qos gt This section of the QoS file enables reliability on the DataReader and DataWriter and tells the middleware that a call to write may block up to 5 seconds if the DataWriter s cache is full of unacknowledged samples If no space opens up in 5 seconds write will Reliable Messaging 6 2 1 2 return with a timeout indicating that the write operation failed and that the data was not sent Set History To KEEP_ALL The History QoS determines the behavior of a DataWriter or DataReader when its inter nal buffer fills up There are two kinds L KEEP_ALL The middleware will attempt to keep all the samples until they are acknowledged when the DataWriter s History is KEEP_ALL or taken by the application when the DataReader s History is KEEP_ALL L KEEP_LAST The middleware will discard the oldest samples to make room for new samples When the DataWriter s History is KEEP_LAST samples are dis carded when a new call to write is performed When the DataReader s History is KEEP_LAST samples in the receive buffer are discarded when new samples are received This kind of history is associated with a depth that indicat
74. hanism see the chapter on Con figuring QoS with XML in the RTI Data Distribution Service User s Manual History Depth The DDS specification which RTI Data Distribution Service implements recognizes two kinds of history KEEP_ALL and KEEP_LAST KEEP_ALL history indicates that the application wants to see every data sample regardless of how old it is subject of course to lifespan and other QoS policies KEEP_LAST history indicates that only a certain number of back samples are relevant this number is indicated by a second parameter the history depth The depth value if any is ignored if the kind is set to KEEP_ALL 5 7 juoWdo eAeg pidpy 10 SU1 HOd UBISEg S 5 2 2 1 1 5 2 2 2 5 8 The News example specifies a default History policy of KEEP_LAST and a depth of 10 see the file USER_QOS_PROFILES xml lt history gt lt kind gt KEEP_LAST_HISTORY_QOS lt kind gt lt depth gt 10 lt depth gt lt history gt Lifespan Duration The Lifespan QoS policy contains a field duration that indicates for how long each sam ple remains valid The duration is measured relative to the sample s reception time stamp which means that it doesn t include the latency of the underlying transport The News example specifies a lifespan of six seconds see the file USER_QOS_PROFILES xml lt lifespan gt lt duration gt lt sec gt 6 lt sec gt lt nanosec gt 0 lt nanosec gt lt duration gt lt li
75. he DataWriter s write operation to publish data A Publisher is used to group individual DataWriters You can A pps Publisher is specify default QoS behavior for a Publisher and have it analogous to the apply to all the DataWriters in that Publisher s group producing aspect of a JMS TopicSession Figure 3 3 Entities Associated with Publications Domain Participant gt oma S Domain The following code from the C Hello_simple example demonstrates creating a DataWriter data_writer participant gt create_datawriter DDS_DATAWRITER_QOS DEFAULT QoS NULL Listener DDS_STATUS_MASK_NONE 3 15 PHOM OII H car ee ie eee 3 2 4 3 16 As you can see each DataWriter is tied to a single topic All data published by that DataWriter will be directed to that Topic As you will learn in the next chapter each Topic and therefore all DataWriters for that Topic is associated with a particular concrete data type The write operation which publishes data is type safe which means that before you can write data you must per form a type cast string_writer DDSStringDataWriter narrow data_writer Here is the analogous code in Java StringDataWriter dataWriter StringDataWriter participant create_datawriter TOPICI Publisher DATAWRITER_QOS_DEFAULT null listener StatusKind STATUS_MASK_NONE Note that in this particular code example you will not find a
76. he History QosPolicy See the Reliability QosPolicy for more informa tion Also the amount of data sent to new DataReaders whose Durability QosPolicy see below is set to receive previously published data is controlled by the His tory QosPolicy Lifespan Specifies how long the middleware should consider data sent by a user application to be valid 4 5 dDUPDWIOJ d PUD s yi qodo y 4 6 The middleware attaches timestamps to all data sent and received When you specify a finite Lifespan for your data the middleware will compare the current time with those timestamps and drop data when your specified Lifespan expires You can use the Lifespan QosPolicy to ensure that applications do not receive or act on data commands or messages that are too old and have expired Durability Specifies whether or not the middleware will store and deliver previ ously published data to new DataReaders This policy helps ensure that DataRead ers get all data that was sent by DataWriters even if it was sent while the DataReader was disconnected from the network It can increase a system s toler ance to failure conditions Fault Tolerance for increased robustness and reduced risk m Liveliness Specifies and configures the mechanism that allows DataReaders to detect when DataWriters become disconnected or dead It can be used during system integration to ensure that systems meet their intended responsiveness specifications It can al
77. hese capabilities online in the Solutions area of the RTI Customer Portal http www rti com support Navi gate to Code Examples and search for Asynchronous Publication 6 17 SOUDWIOLed YIH 10 SUI HOd UBISEg 9 6 4 1 2 6 4 1 3 6 18 Acknowledge and Repair Efficiently Piggyback heartbeat with each sample A DataWriter sends heartbeats meta data messages announcing available data and requesting acknowledgement in two ways periodically and piggybacked into application data packets Piggybacking heartbeats aggressively ensures that the middleware will detect packet losses early while allowing you to limit the number of extraneous network sends related to periodic heartbeats lt datawriter_qos gt lt resource_limits gt lt Used to configure piggybacks w o batching gt lt max_samples gt 20 lt An arbitrary finite size gt lt max_samples gt lt resource_limits gt lt writer_resource_limits gt lt Used to configure piggybacks w batching see below gt lt max_batches gt 20 lt An arbitrary finite size gt lt max_batches gt lt writer_resource_limits gt lt protocol gt lt rtps_reliable_writer gt lt heartbeats_per_max_samples gt 20 lt Set same as max_samples gt lt heartbeats_per_max_samples gt lt rtps_reliable_ writer gt lt protocol gt lt datawriter_qos gt The heartbeats_per_max_samples parameter controls how often the middleware will
78. hroughput data above expressed in terms of samples per second Collecting samples into a batch implies that they are not sent on the network flushed immediately when the application writes them this can potentially increase latency However if the application sends data faster than the network can support an increased share of the network s available bandwidth will be spent on acknowledge ments and resending dropped data In this case reducing that meta data overhead by turning on batching could decrease latency even while increasing throughput Only an evaluation of your system s requirements and a measurement of its actual performance will indicate whether batching is appropriate Fortunately it is easy to enable and tune batching as you will see below Batching is particularly useful when the system has to send a large number of small messages at a fast rate Without this feature enabled you may observe that your maxi mum throughput is less than the maximum bandwidth of your network Simultane ously you may observe high CPU loads In this situation the bottleneck in your system is the ability of the CPU to send packets through the OS network stack For example in some algorithmic trading applications market data updates arrive at a rate of from tens of thousands of messages per second to over a million each update is some hundreds of bytes in size It is often better to send these updates in batches than to publish them individuall
79. ilability requirements I Transient Data that has been sent may be relevant to late joining subscribers and will be stored externally to the DataWriter that produced that data This level of durability requires one or more instances of the RTI Persistence Service on your network As long as one or more of these persistence service instances is func tional the durable data will continue to be available even if the original DataWriter shuts down or fails However if all instances of the persistence ser vice shut down or fail the durable data they were maintaining will be lost This level of durability provides a higher level of fault tolerance and availability than does transient local durability without the performance or management over head of a database I Persistent Data that has been sent may be relevant to latejoining subscribers and will be stored externally to the DataWriter that produced that data in a relational database This level of durability requires one or more instances of the RTI Persis tence Service on your network It provides the greatest degree of assurance for your most critical data streams because even if all data writers and all persis tence server instances fail your data can nevertheless be restored and made available to subscribers when you restart the persistence service As you can see the level of durability indicates not only whether historical data will be made available to late joining subscribers it
80. ill also want to look at additional documentation available online In particular RTI recommends the following LJ RTI Public Knowledge Base Accessible from http www rti com support The Knowledge Base provides sample code general information on RTI Data Distribution Service performance information troubleshooting tips and other technical details L RTI Customer Portal Accessible from http www rti com support The por tal provides a superset of the solutions available in the RTI Public Knowledge Base Select the Find Solution link to see sample code general information on RTI Data Distribution Service performance information troubleshooting tips and other technical details You must have a user name and password to access the portal these are included in the letter confirming your purchase If you do not have this letter please contact license rti com L RTI Example Performance Test This example application includes code and configuration files for testing and optimizing the performance of a simple RTI Data Distribution Service application on your system The program will test both throughput and latency under a wide variety of middleware configurations It also includes documentation on tuning the middleware and the underlying Operating system The performance test can be downloaded from the RTI Knowledge Base accessi ble from http www rti com support In the Performance category look for Example Performance Test for
81. imple 2 Type gt build sh 3 6 The same example code is provided in C C C and Java The following instructions cover C and Java in detail the procedures for C and C are very similar The same source code can be built and run on different architecture The instructions also focus on Windows and UNIX based systems If you use an embedded platform see the Embedded Systems Addendum RTI_DDS_GettingStarted_ EmbeddedSystemsAddendu m pdf for more instructions especially for you Building and Running Hello World C on Windows Systems To build the example applications 1 In the Windows Explorer go to NDDSHOME exam ple CPP Hello_simple win32 and open the Microsoft Visual Studio solution file for your architecture For example the file for Visual Studio 2005 for 32 bit platforms is Hello i86Win32VS2005 sIn 2 The Solution Configuration combo box in the toolbar indicates whether you are building debug or release executables select Release Select Build Solution from the Build menu oe Hello vs2005 Microsoft Visual Studio File Edit view Project Build Debug Tools Window Community Help TRARA A W Spee Wee ei Solution Explorer HelloPubli A X HelloSubscriber cpp 4 HelloPublisher cpp 4 i iE Unknown Scope Ol S Solution Hello vs2005 2 projects j E Z EERRERRRERRRRRRRERRRERERRRRREERRERERERERRERRERRR EF HelloPublisher it ic Copyright Real Ti
82. ing the libraries and other things you need for deployment The following instructions describe both situations I Installing Using an Installer Application Section 2 1 2 1 J Installing from Zip Archives Section 2 1 2 2 Installing Using an Installer Application If you have run the installer before and are reinstalling the software be aware that the installer will not automatically remove previous installations as a part of a new installa tion If you want to replace a previous installation or you want to modify it but are unsure of which settings you selected originally RTI recommends that you uninstall the software using Add or Remove Programs from the Control Panel before reinstalling it The installer is a single executable file Run the installer and follow the directions on the screen It will prompt you to choose whether to install the software only for yourself or for all users of your computer the latter option will require administrative privileges By default the installer will place its files in the directory lt path gt RTI ndds lt version gt where lt path gt depends on whether you re installing only for yourself or for all users and lt version gt is the version of RTI Data Distribution Service you re installing for exam ple C Program Files RTI ndds 4 4x Note If you have a license managed distribu tion of RTI Data Distribution Service the directory will be lt path gt RTI ndds lt version gt _lic Y
83. ing with Data Types As your system evolves you may find that your data types need to change And unless your system is relatively small you may not be able to bring it all down at once in order to modify them Instead you may need to upgrade your types one component at a time or even on the fly without bringing any part of the system down While covering dynamic types is outside the scope of this chapter you can learn more about the subject in Chapter 3 of the RTI Data Distribution Service User s Manual You can also view and run the Hello World example code located in NDDSHOME example lt language gt Hello_dynamic src 4 17 SOUDUWO IOd PUD seyIIIqoddd y 4 18 Chapter 5 Design Patterns for Rapid Development In this chapter you will learn how to implement some common functional design pat terns As you have learned one of the advantages to using RTI Data Distribution Service is that you can achieve significantly different functionality without changing your application code simply by updating the XML based Quality of Service QoS parame ters In this chapter we will use a simple News example to illustrate these design patterns A news publishing application distributes articles from a variety of news outlets CNN Bloomberg etc on a periodic basis However the period differs from outlet to outlet One or more news subscribers poll for available articles also on a periodic basis and print out their contents
84. k addresses Its built in automatic discovery capability is one important way in which RTI Data Distribution Service differs from other networking middleware implementations It is designed to be low overhead and require minimal configuration so in many cases there is nothing you need to do it will just work Nevertheless it s helpful to under stand the basics so that you can decide if and when a custom configuration is necessary Before applications can communicate they need to discover each other By default RTI Data Distribution Service applications discover each other using shared memory or UDP loopback if they are on the same host or using multicast if they are on different hosts Therefore to run an application on two or more computers using multicast or on a single computer with a network connection no changes are needed They will dis cover each other automatically The chapter on Discovery in the RTI Data Distribution Service User s Manual describes the process in more detail If you want to use computers that do not support multicast or you need to use unicast for some other reason or if you want to run on a single computer that does not have a network connection in which case your operating system may have disabled your net work stack there is a simple way to control the discovery process you won t even have to recompile Application discovery can be configured through the NDDS_DISCOVERY_PEERS environment variab
85. l data encoding alignment and padding issues The send everything alternative results in large amounts of redundant information being sent with every packet impacting performance Figure 4 1 Self Describing Messages vs Type Definitions Self Describing Messages Handler Automatic Discovery type string Symbol text Price float RTI Data Distribution Service exchanges data type definitions such as field names and types once at application start up time This increases performance and reduces bandwidth consumption compared to the conventional approach in which each message is self describing and thus includes a substantial amount of metadata along with the actual data RTI Data Distribution Service takes an intermediate approach Just as objects in your application program belong to some data type data samples sent on the same Topic share a data type This type defines the fields that exist in the data samples and what their constituent types are RTI Data Distribution Service stores and propagates this meta information separately from the individual data samples allowing it to propagate sam ples efficiently while handling byte ordering and alignment issues for you With RTI you have a number of choices when it comes to defining and using data types You can choose one of these options or you can mix and match them these approaches 4 8 Compact Type Safe Data Programming with Data Ty
86. le The fixed cost of traversing your operating system s network stack is greater relative to the cost of actually transmitting your data at small sample sizes as you increase the sample size you will see the throughput more closely approach the theoretical throughput of your network By batching multiple data samples into a single network packet as the high throughput example QoS profile does you should be able to saturate a gigabit Ethernet network with samples sizes as small as 100 200 bytes Without batching samples you should be able to saturate the network with samples of a few kilo bytes The difference is due to the performance limitations of the network trans port enterprise class platforms with commodity Ethernet interfaces can typically execute tens of thousands of send s per second In contrast saturating a high throughput network link with data sizes of less than a kilobyte requires hundreds of thousands of samples per second Is this the best possible performance The performance of an application depends heavily on the operating system the net work and how it configures and uses the middleware This example is just a starting point tuning is important for a production application RTI can help you get the most out of your platform and the middleware To get a sense for how an application s behav ior changes with different QoS contracts try one of the other provided example QoS profiles and see how the printed re
87. le or in your QoS configuration file 1 With the exception of LynxOS On LynxOS systems multicast is not used for discovery by default unless NDDS_DISCOVERY_PEERS is set Automatic Application Discovery 4 1 1 When to Set the Discovery Peers There are only a few situations in which you must set the discovery peers In the following replace N with the number of RTI Data Distribution Service applica tions you want to run 1 If you cannot use multicast Set your discovery peers to a list of all of the hosts that need to discover each other The list can contain hostnames and or IP addresses each entry should be of the form N builtin udpv4 lt hostname IP gt 2 If you do not have a network connection Some operating systems for example Microsoft Windows disable some functionality of their network stack when they detect that no network interfaces are available This can cause problems when applications try to open network connections e If your system supports shared memory set your discovery peers to N builtin shmem This will enable the shared memory transport only e If your system does not support shared memory or it is disabled set your discovery peers to the loopback address N builtin ud pv4 127 0 0 1 4 1 2 How to Set Your Discovery Peers As stated above in most cases you do not need to set your discovery peers explicitly If setting them is required there are two easy ways to do so
88. les Unpack them as described below Depending on your version of Windows and where you want to expand these files your user account may or may not require administrator privileges 1 Create a directory for RTI Data Distribution Service We will assume that you want to install under C Program Files RTI you may replace references to C Pro gram Files RTI with the directory of your choice 2 Move the downloaded files into your newly created directory 3 Extract the distribution from the uncompressed files You will need a zip file util ity such as WinZip to help you Using our example path you will end up with C Program Files RTI ndds 4 x Next read License Management Section 2 2 License Management Some distributions of RTI Data Distribution Service require a license file in order to run for example those provided for evaluation purposes or on a subscription basis A sin gle license file can be used to run on any architecture and is not node locked You are not required to run a license server Obtaining a License File If your RTI Data Distribution Service distribution requires a license file you will receive one from RTI via email after you download the software If you did not receive one please email support rti com or contact your RTI account representative Save the license file in any location of your choice the locations checked by the middle ware are listed below If you have licenses for both RTI
89. m Bloomberg Lorem ipsum 1 From NY Times Lorem ipsum 1 9 50 13 AM From NY Times Lorem ipsum 1 From Economist Lorem ipsum 1 9 50 13 AM From Economist Lorem ipsum 1 From Reuters Lorem ipsum 2 9 50 13 AM From Reuters Lorem ipsum 2 From Reuters Lorem ipsum 3 9 50 14 AM From Reuters Lorem ipsum 3 From AP Lorem ipsum 2 9 50 14 AM From AP Lorem ipsum 2 From Reuters Lorem ipsum 4 9 50 14 AM From Reuters Lorem ipsum 4 From CNN Lorem ipsum 2 9 50 14 AM From CNN Lorem ipsum 2 From Reuters Lorem ipsum 5 iVailable articles as of 9 50 16 AM From AP Lorem ipsum 3 9 50 13 AM From AP Lorem ipsum 1 cached From Bloomberg Lorem ipsum 2 9 50 13 AM From CNN Lorem ipsum 1 cached From Reuters Lorem ipsum 6 9 50 13 AM From Bloomberg Lorem ipsum 1 cached From NY Times Lorem ipsum 2 9 50 13 AM From NY Times Lorem ipsum 1 cached From Reuters Lorem ipsum 7 9 50 13 AM From Economist Lorem ipsum 1 cached From AP Lorem ipsum 4 9 50 14 AM From AP Lorem ipsum 2 cached From CNN Lorem ipsum 3 9 50 14 AM From CNN Lorem ipsum 2 cached From Economist Lorem ipsum 2 9 50 14 AM From Reuters lorem ipsum 5 From Reuters Lorem ipsum 8 9 50 14 AM From AP Lorem ipsum 3 From Reuters
90. me Innovations C HelloPublisher cpp j7 5 Ga HelloSubscriber f Permission to modify and use for inte c HelloSubscriber cpp Jt This software is nrovided as is without wa C on UNIX based Systems To build the example applications 1 From your command shell go to NDDSHOME example CPP Hello_simple 2 Type gt gmake f make Makefile lt architecture gt where lt architecture gt is one of the supported architectures see the contents of the make directory for a list of available architectures If you do not see a makefile for your architecture please refer to Section 4 3 2 1 to learn how to generate a makefile or project files for your platform This command will build a release executable To build a debug version instead type gt gmake f make Makefile lt architecture gt DEBUG 1 3 7 PHOM OII H E 3 1 3 Step 3 Start the Subscriber Java To start the subscribing application As described above you should have already set your path appropriately so that the example application can load the native libraries on which RTI Data Distribution Service depends If you have not you can set the variable RTI_ EXAMPLE_ARCH in your com mand shell e g to i86Win32jdk or i86Linux2 6gcc4 1 1 jdk and the example launch scripts will use it to set your path for you L On a Windows system From your command shell go to NDDSHOME example JAVA Hello_simple and type gt runSub J On a UNIX based system
91. mmunica tion requirements 3 10 Data Distribution Service DDS 101 3 2 1 An Overview of DDS Objects The primary objects in RTI Data Distribution Service are L DomainParticipants LJ Publishers and DataWriters L Subscribers and DataReaders LI Topics L Keys and Samples Figure 3 1 DDS Components 3 2 2 DomainParticipants A domain is a concept used to bind individual applications together for communication To communicate with each other DataWriters and DataReaders must have the same Topic of the same data type and be members of the same domain Each domain has a unique integer domain ID Applications in one domain cannot subscribe to data published in a different domain Multiple domains allow you to have multiple virtual distributed systems on the same physical network This can be very useful if you want to run multiple independent tests of the same applications You can run them at the same time on the same network as long as each test runs in a different domain Another typical configuration is to isolate your development team from your test and production teams you can assign each team or even each developer a unique domain DomainParticipant objects enable an application to exchange messages within DDS domains An application A DDS DomainParticipant must have a DomainParticipant for every domain in which iS analogous to a JMS the application will communicate Unless your applica Commana tion is a
92. n of RTI Data Distribution Service If you are upgrading from a previous version read this document first L Release Notes and Platform Notes RTI_DDS_ReleaseNotes pdf and RTI_DDS_PlatformNotes pdf These documents provide system requirements compatibility and other platform specific information about the product includ ing specific information required to build your applications using RTI Data Dis tribution Service such as compiler flags and libraries uoojuawnooq SIQDIIDAY Z User s Manual RTI_DDS_UsersManual pdf This document describes the fea tures of the product and how to use them It is organized around the structure of the DDS APIs and certain common high level tasks L API Documentation ReadMe html RTI DDS_ApiReference lt Language gt pdf This extensively cross referenced documentation available both in HTML and printable PDF formats is your in depth reference to every operation and config uration parameter in the middleware Even experienced RTI Data Distribution Service developers will often consult this information The Programming How To s available from the main page provide example code These are hyperlinked code snippets to the full API documentation and provide a good place to begin learning the APIs Start by reviewing the Publi cation Example and Subscription Example which provide step by step exam ples of how to send and receive data with RTI Data Distribution Service Many readers w
93. ns to run your first middle ware program using RTI Data Distribution Service 3 1 PHOM OIISH 3 1 1 3 1 1 1 3 2 Step 1 Set Up the Environment There are a few things to take care of before you start working with the example code Set Up the Environment on Your Development Machine a Set the NDDSHOME environment variable Set the environment variable NDDSHOME to the RTI Data Distribution Service install directory RTI Data Distribution Service itself does not require that you set this environment variable It is used in the scripts used to build and run the example code because it is a simple way to locate the install directory You may or may not choose to use the same mechanism when you create scripts to build and or run your own applications e On UNIX based systems This location may be opt rti ndds 4 4x e On Windows systems This location may be C Program Files RTI ndds 4 4x The installer gave you the option to set this environment variable automati cally as part of the installation process If you have multiple versions of RTI Data Distribution Service installed As men tioned above RTI Data Distribution Service does not require that you have the environment variable NDDSHOME set at run time However if it is set the middleware will use it to load certain configuration files Additionally you may have previously set your path based on the value of that variable Therefore if you have NDDSHOME set
94. ny reference to the Publisher class In fact creating the Publisher object explicitly is optional because many applica tions do not have the need to customize any behavior at that level If you like this exam ple choose not to create a Publisher the middleware will implicitly choose an internal Publisher object If you do want to create a Publisher explicitly create it with a call to par ticipant create_publisher you can find more about this method in the online documen tation and then simply replace the call to participant create_datawriter with a call to publisher create_datawriter Subscribers and DataReaders A DataReader is the point through which a subscribing application accesses the data that it has received over the A DDS DataReader is network analogous to a JMS TopicSubscriber Just as Publishers are used to group DataWriters Subscribers E f A DDS Subscriber is are used to group DataReaders Again this allows you to analogous m ihe configure a default set of QoS parameters and event han consuming aspect of a JMS dling routines that will apply to all DataReaders in the Sub TopicSession scriber s group Data Distribution Service DDS 101 Figure 3 4 Entities Associated with Subscriptions read Domain Participant Domain The following code from the C Hello_simple example demonstrates creating a DataReader data_reader participant gt create_datareader DDS_DATAREADER_QOS_
95. oWorldTypeSupport get_type_name 4 15 SOUDUWO Od PUD SeyIIIGodDd vy The Java version of this program Hello java takes the same steps DomainParticipant participant DomainParticipantFactory get_instance create_participant arg domaintid DomainParticipantFactory PARTICIPANT _QOS_DEFAULT null listener StatusKind STATUS_MASK_NONE HelloWorldTypeSupport register_type participant HellowWorldTypeSupport get_type_name Note that in Java errors during type registration are reported with exceptions Next the example creates a Topic that will be used to publish samples of the type that we just registered using the name of the data type topic participant gt create_topic arg topicName c_str HelloWorldTypeSupport get_type_name DDS_TOPIC_QOS_DEFAULT NULL listener DDS_STATUS_MASK_NONE Here s the same logic in Java Topic topic participant create_topic arg topicName Java HelloWorldTypeSupport get_type_name DomainParticipant TOPIC_QOS_DEFAULT null listener StatusKind STATUS_MASK_ NONE 4 3 3 Running with Dynamic Types This method may be appropriate for applications for which the structure type of mes sages changes frequently or for deployed systems in which newer versions of applica tions need to interoperate with existing applications that cannot be recompiled to incorporate message type changes 4 16 Compact Type Safe Data Programm
96. olumns in the subscriber side output similar to Figure 6 1 L Seconds from start The number of seconds the subscribing application has been running It will print out one line per second k Total samples The number of data samples that the subscribing application has received since it started running Building and Running the Code Examples Figure 6 1 Example Output from the Subscribing Application ane Terminal ssh 75x25 gt 0bjs 186Linux2 6gcc3 4 3 Hello sub domain 13 Hello Example Application Copyright 20088 Real Time Innovations Inc Sec from Total Total Lost Curr Lost Average ICurrent IThroughput start samples samples samples smpls sec Ismpls sec IMbps 1 3984 3984 00 3984 00 31 09 2 8112 4056 00 4128 00 32 22 3 12096 4932 00 3984 08 31 09 a 16128 4932 08 4932 00 31 47 5 20112 4022 40 3984 08 31 09 6 24144 4024 00 4032 00 31 47 7 28176 4925 14 4032 00 31 47 8 32160 4020 00 3984 00 31 09 9 36432 4048 00 4272 00 33 34 10 42800 4080 00 4368 00 34 09 11 45168 4106 18 4368 00 34 09 12 49536 4128 00 4368 00 34 09 13 53904 4146 46 4368 00 34 09 14 58272 4162 29 4368 00 34 09 15 62304 4153 60 4032 00 31 47 16 66288 4143 00 3984 00 31 09 17 70320 4136 47 4932 08 31 47 I Total lost samples The number of samples that were lost in transit and could not be re paired since the subscribing application started running If you ar
97. on Service depends If you have not you can set the variable RTILEXAMPLE_ARCH in your com mand shell e g to i86Win32jdk or i86Linux2 6gcc4 1 1 jdk and the example launch scripts will use it to set your path for you L On a Windows system From a different command shell go to NDDSHOME example JAVA Hello_simple and type gt runPub On a UNIX based system From a different command shell go to NDDSHOME example J AVA Hello_simple and type gt runPub sh C To start the publishing application L On a Windows system From a different command shell go to NDDSHOME example CPP Hello_simple and type gt objs lt architecture gt HelloPublisher exe where lt architecture gt is one of the supported architectures see the contents of the win32 directory for a list of available architectures For example the Windows architecture name corresponding to 32 bit Visual Studio 2005 is i86Win32VS2005 L On a UNIX based system From a different command shell go to NDDSHOME example CPP Hello_simple and type gt objs lt architecture gt HelloPublisher where lt architecture gt is one of the supported architectures see the contents of the make directory for a list of available architectures For example the Linux archi tecture corresponding to Red Hat Enterprise Linux 5 is i86Linux2 6gcc4 1 1 3 9 PHOM OIISH If you typed Hello World in the publishing application you should see output similar to the foll
98. on the subscriber side when a sample is received it is stored inside an internal receive buffer waiting for the application to take the data for processing If the subscribing application doesn t take the received samples fast enough the internal receive buffer may fill up in that case newly received data will be discarded and would need to be repaired by the reliable protocol Although the size of those buffers can be controlled from the QoS you can also use QoS to control what RTI Data Distribution Service will do when the space available in one of those buffers is exhausted There are two possible scenarios for both the publisher and subscriber Publishing side If write is called and there is no more room in the DataWriter s buffer RTI Data Distribution Service can 1 Temporarily block the write operation until there is room on this buffer for example when one or more samples is acknowledged to have been received from all the subscribers 2 Drop the oldest sample from the queue to make room for the new one Subscribing side If a sample is received from a publisher and there is no more room on the DataReader s buffer 1 Drop the sample as if it was never received The subscribing application will send a negative acknowledgement requesting that the sample be resent 2 Drop the oldest sample from the queue to make room for the new one 1 RTI Data Distribution Service also supports reliability based only on neg
99. on with the Reliability and History policies is to govern how far ahead of its DataReaders a DataWriter may get before it will block waiting for them to catch up In many systems consuming applications cannot acknowledge data as fast as its producing applications can put new data on the network In such cases the Resource Limits policy provides a throttling mechanism that governs how many sent but not yet acknowledged samples a DataWriter will maintain If a DataWriter is configured for reliable KEEP_ALL opera tion and it exceeds max_samples calls to write will block until the writer receives acknowledgements that will allow it to reclaim that memory If you see that your reliable publishing application is using an unacceptable amount of memory you can specify a finite value for max_samples By doing this you restrain the size of the DataWriter s cache causing it to use less memory however a smaller cache will fill more quickly potentially causing the writer to block for a time when sending decreasing throughput If decreased throughput proves to be an issue you can tune the reliability protocol to process acknowledgements and repairs more aggressively allow ing the writer to clear its cache more effectively A full discussion of the relevant reliabil ity protocol parameters is beyond the scope of this example However you can find a High Throughput for Streaming Data 6 3 useful example in high_throughput xml Also see th
100. optional because many applications do not have the need to customize any behavior at that level If you like this example choose not to create a Subscriber the middleware will implicitly choose an internal Subscriber object If you do want to create a Subscriber explicitly create it with a call to participant create_subscriber you can find more about this method in the online documentation and then simply replace the call to partici pant create_datareader with a call to subscriber create_datareader Topics Topics provide the basic connection points between DataWriters and DataReaders To communicate the Topic of a DataWriter on one node must match the Topic of a DataReader on any other node A Topic is comprised of a name and a type The name is a string that uniquely identifies the Topic within a domain The type is the structural definition of the data contained within the Topic this capability is described in Chapter 4 Capabilities and Performance The C Hello_simple example creates a Topic with the following code topic participant gt create_topic Hello World Topic name DDSStringTypeSupport get_type_name Type name DDS_TOPIC_QOS_DEFAULT Topic Qos NULL Is tenera DDS_STATUS_MASK_NONE 3 19 PHOM OIISH 3 2 6 3 20 Besides the new Topic s name and type an application specifies three things I A suggested set of QoS for DataReaders and DataWriters for this Topic I
101. os gt For more information please see the RTI Data Distribution Service Platform Notes User s Manual and online documentation from the main page select Modules Infrastructure Module QoS Policies DISCOVERY Customizing Behavior QoS Configuration Almost every object in the DDS API is associated with QoS policies that govern its behavior These policies govern everything from the amount of memory the object may use to store incoming or outgoing data to the degree of reliability required to the amount of meta traffic that the middleware will send on the network and many others The following is a short summary of just a few of the available policies Customizing Behavior QoS Configuration Reliability and Availability for Consistent Performance l Reliability Specifies whether or not the middleware will deliver data reliably The reliability of a connection between a DataWriter and DataReader is entirely user configurable It can be done on a per DataWriter DataReader connection For some use cases such as the periodic update of sensor values to a GUI dis playing the value to a person best effort delivery is often good enough It is the fastest most efficient and least resource intensive CPU and network band width method of getting the newest latest value for a topic from DataWriters to DataReaders But there is no guarantee that the data sent will be received It may be lost due to a variety of factors including d
102. ou may choose an alternative directory if you wish 2 3 UOHDI D SU Z The combination of the hardware operating system and compiler tool chain on the machine s where your application will be deployed is referred to as that machine s tar get architecture Check the boxes to install the libraries corresponding to your environ ment Choose Components Choose which features of RTI Data Distribution Service 4 4d you want to install Check the components you want to install and uncheck the components you don t want to install Click Next to continue Select components to install i86Win32VS2005 rors osition vo nouse Y isswin32vs2008 over 4 component to x64Win64VS2005 see its description x64Win64VS2008 i86Win32jdk x64Win64jdk i86Win32dotnet2 0 Space required 816 7MB Nullsoft Install System v2 44 The installer will prompt you to choose whether or not to set two environment vari ables RTI recommends that you make both of these changes The installer can I Set the NDDSHOME environment variable to the RTI Data Distribution Service installation directory such as C Program Files RTI ndds 4 4x where x is a version specific letter L Update your Path environment variable to include NDDSHOME scripts Next read License Management Section 2 2 2 4 License Management 2 1 2 2 2 2 2 2 1 Installing from Zip Archives The distribution is packaged in one or more zip fi
103. overhead Be careful not to set your batch size larger than your link s MTU see Managing Your Sample Size Section 6 4 1 1 For more information on how to configure throughput for small samples see High Throughput for Streaming Data Section 6 3 6 19 SOUDWOLed YIH 10 SUI HOd UBIsEg 9 6 20 Chapter 7 The Next Steps Congratulations You have completed the Getting Started Guide This document is of course only an introduction to the power and flexibility of RTI Data Distribution Service We invite you to explore further by referring to the wealth of information examples and resources available The RTI Data Distribution Service documentation includes L Getting Started Guide RTI_DDS_GettingStarted pdf This document describes how to download and install RTI Data Distribution Service It also lays out the core value and concepts behind the product and takes you step by step through the creation of a simple example application Developers should read this document first If you are using RTI Data Distribution Service on an embedded platform or with a database you will find additional documents that specifically address these configurations e Addendum for Embedded Systems RTI_DDS_GettingStarted_EmbeddedSystemsAddendum pdf e Addendum for Database Setup RTI_DDS_GettingStarted_DatabaseAddendum pdpf L What s New RTI_DDS_WhatsNew pdf This document describes changes and enhancements in the current versio
104. owing o_simp e gt 0b S 1 861 n3 2V52005 He Ready to write data hen the subscriber is ready you can start writing Press CTRL C to terminate or enter an empty line to do a clean shutdown Hello World Ready to read data Press CTRL C to terminate Hello World Congratulations You ve run your first RTI Data Distribution Service program 3 2 Data Distribution Service DDS 101 RTI Data Distribution Service is network middleware for real time distributed applica tions It provides the communications service that programmers need to distribute time critical data between embedded and or enterprise devices or nodes RTI Data Distribu tion Service uses a publish subscribe communications model to make data distribution efficient and robust RTI Data Distribution Service implements the Data Centric Publish Subscribe DCPS API of the OMG s specification Data Distribution Service DDS for Real Time Systems DDS is the first standard developed for the needs of real time systems providing an efficient way to transfer data in a distributed system With RTI Data Distribution Service you begin your development with a fault tolerant and flexible communications infrastruc ture that will work over a wide variety of computer hardware operating systems lan guages and networking transport protocols RTI Data Distribution Service is highly configurable so programmers can adapt it to meet an application s specific co
105. pes 4 3 1 interoperate with each other and across programming languages and platforms So your options are I Use the built in types If a message is simply a string or a buffer of bytes you can use RTT s built in types described in Using Built in Types Section 4 3 1 l Define a type at compile time using a language independent description lan guage and the RTI code generator rtiddsgen as described in Using Types Defined at Compile Time Section 4 3 2 This approach offers the strongest compile time type safety The code generator accepts data type definitions in a number of formats to make it easy integrate RTI Data Distribution Service with your development processes and IT infrastructure e OMG IDL This format is a standard component of both the DDS and CORBA specifications It describes data types with a C like syntax This format is described in Chapter 3 of the User s Manual e XML schema XSD whether independent or embedded in a WSDL file XSD may be the format of choice for those using RTI Data Distribution Service alongside or connected to a web services infrastructure This format is described in Chapter 3 of the User s Manual e XML ina DDS specific format This XML format is terser and therefore easier to read and write by hand than an XSD file It offers the general benefits of XML extensibility and ease of integration while fully supporting DDS specific data types and concepts This format
106. plementation ccccccccceccscessscscensneeseseeesesescecesesssesenesesceceesssesnensnesesesneneneseeees 6 14 7 The Next Steps vi Chapter 1 Welcome to RTI Data Distribution Service Welcome to RTI Data Distribution Service the highest performing DDS compliant mes saging system in the world RTI Data Distribution Service makes it easy to develop deploy and maintain distributed applications It has been proven in hundreds of unique designs for life and mission critical applications across a variety of industries RTI Data Distribution Service provides LJ Ultra low latency extremely high throughput messaging m Industry leading reliability and determinism I Connectivity for heterogeneous systems spanning thousands of applications RTI Data Distribution Service is flexible extensive quality of service QoS parameters adapt to your application assuring that you meet your real time reliability and resource usage requirements This chapter introduces basic concepts and summarizes how RTI Data Distribution Ser vice addresses your high performance needs After this introduction we ll jump right into building distributed systems The rest of this guide covers I First steps Installing RTI Data Distribution Service and creating your first simple application I Learning more An overview of the APIs and programming model with a special focus on the communication model data types and qualities of service J Towards real world
107. ples Instances and Keys in the RTI Data Distribution Service User s Manual Implementation The News example uses the read method not the take method That means that data is only removed from the DataReader s cache based on the history depth or the lifespan duration never because the application removed it explicitly 5 15 JuoWdojeAeg pidpy 10 SUIO Dg UBISEg S The call to read looks like this in C DDS_ReturnCode_t result _reader gt read CH articles fill in data here articleInfos fill in parallel meta data here DDS_LENGTH_UNLIMITED any articles DDS_ANY_SAMPLE_STATE DDS_ANY_VIEW_STATE DDS_ANY_INSTANCE_STATE if result DDS_RETCODE_NO_DATA nothing to read go back to sleep if result DDS RETCODETOK an error occurred stop reading throw std runtime_error A read error occurred result Process data _reader gt return_loan articles articleInfos It looks like this in Java Igy i _reader read articles fill in data here articleInfos fill in parallel meta data here ResourceLimitsQosPolicy LENGTH_ UNLIMITED any articles SampleStateKind ANY_ SAMPLE _ STATE ViewStateKind ANY_VIEW_STATE InstanceStateKind ANY_INSTANCE_STATE Process data catch RETCODE_NO_DATA noData nothing to read go back to sleep catch RETCODE_ERROR ex an error occurred stop reading throw ex finally
108. ples The number of samples that were lost in transit and could not be repaired since the subscribing application started running If you are using a QoS profile configured for strict reliability you can expect this column to always display 0 If you re running in best effort mode or in a limited reliability mode e g you have configured your History QosPolicy to only keep the most recent sample you may see non zero values here 4 12 L Current lost samples The number of samples that were lost in transit and could not be repaired since the last status line was printed See the description of the previous column for information about what values to expect here L Average samples per second The mean number of data samples received per second since the subscribing application started running By default these exam ple applications send data samples that are 1 KB in size You can change this by passing a different size in bytes to the publishing application with size _ Current samples per second The number of data samples received since the sub scribing application printed the last status line l Throughput megabits per second The throughput from the publishing applica tion to the subscribing application in bits per second since the subscribing application printed the previous status line The value in this column is equiva lent to the current samples per second multiplied by the number of bits in an individual samp
109. problem in TCP based solutions Implementation When designing a system that demands reliability over a network that is lossy and has high latency and low throughput it is critical to consider J How much data you send at one time e g your sample or batch size L How often you send it I The tuning of the reliability protocol for managing meta and repair messages It is also important to be aware of whether your network supports multicast communi cation if it does not you may want to explicitly disable it in your middleware configu ration e g by using the NDDS_DISCOVERY_PEERS environment variable or setting the initial_peers and multicast_receive_address in your Discovery QoS policy see the online API documentation Managing Your Sample Size Pay attention to your packet sizes to minimize or avoid IP level fragmentation Frag mentation can lead to additional repair meta traffic that competes with the user traffic for bandwidth Ethernet like networks typically have a frame size of 1500 bytes on such networks sample sizes or sample fragment sizes if you ve configured RTI Data Distri bution Service to fragment your samples should be kept to approximately 1400 bytes or less Other network types will have different fragmentation thresholds The exact size of the sample on the wire will depend not only on the size of your data fields but also on the amount of padding introduced to ensure alignment while serializ ing the d
110. re Many real world applications will choose to process data as soon as it arrives rather than polling for it For more information about the different ways to read data select Modules Programming How To s DataReader Use Cases in the online API documentation In this case periodic polling makes the behavior easy to illustrate Along with each article it prints it includes the time at which that article was published and whether that article has been read before or whether it was cached from a previous read By default both the publishing and subscribing applications run for 20 seconds and then quit To run them for a different number of seconds use the r command line argument Figure 5 1 shows example output using the default run time and a domain ID of 13 set with the command line option d 13 Figure 5 1 Example Output for Both Applications Terminal ssh 60x45 i gt run sh sub d 13 s Example Application copyright 2009 Real Time Innovations Inc gt run sh pub d 13 News Example Application Copyright 2009 Real Time Innovations Inc Articles published in Last period as of 9 5 15 AM wailable articles as of 9 50 14 AM From Reuters Lorem ipsum 1 9 50 13 AM From Reuters Lorem ipsum 1 From AP Lorem ipsum 1 9 50 13 AM From AP Lorem ipsum 1 From CNN Lorem ipsum 1 9 50 13 AM From CNN Lorem ipsum 1 From Bloomberg Lorem ipsum 1 9 50 13 AM Fro
111. requirements It features m m m m Peer to peer publish subscribe communications The most elegant flexible data communications model e Simplified distributed application programming e Time critical data flow with minimal latency e Clear semantics for managing multiple sources of the same data e Customizable Quality of Service and error notification e Guaranteed periodic messages with minimum and maximum rates set by subscriptions e Notifications when applications fail to meet their deadlines e Synchronous or asynchronous message delivery to give applications con trol over the degree of concurrency e Ability to send the same message to multiple subscribers efficiently including support for reliable multicast with customizable levels of posi tive and negative message acknowledgement Reliable messaging Enables subscribing applications to customize the degree of reliability required Reliability can be tuned you can guarantee delivery no matter how many retries are needed or try messages only once for fast and deter ministic performance You can also specify any settings in between No other middleware lets you make this critical trade off on a per message stream basis Multiple communication networks Multiple independent communication net works domains each using RTI Data Distribution Service can be used over the same physical network to isolate unrelated systems or subsystems Individual application
112. rtiddsgen understands and a brief description of each of them run it with the help argument More information about rtiddsgen includ ing its command line parameters and the list of files it creates can be found in Section 3 7 of the RTI Data Distribution Service User s Manual To generate additional example code The Hello_idl example code that is shipped with RTI Data Distribution Service uses the HelloWorld data type However you can use rtiddsgen to generate a simple Hello World example application for any of your own data types The code generator will also generate make project files for this example to allow you to build it and to serve as further examples you can use as you configure your own build system These build files can be generated for any architecture RTI supports To generate such an example pass the example flag to the code generator gt rtiddsgen ppDisable language lt language gt example lt architecture gt lt file gt 1 The argument ppDisable tells the code generator not to attempt to invoke the C preprocessor usually cpp on UNIX and cl on Windows on the IDL file prior to generating code In this case the IDL file con tains no preprocessor directives so no preprocessing is necessary However if the preprocessor execut able is already on your system path on Windows running the Visual Studio script vevars32 bat will do this for you you can omit this argument regardless Compact
113. s 10 02 47 AM From ONN 10 02 47 AM From Reuters 10 02 47 AM From Reuters 10 02 47 AM From Reuters 10 02 47 AM From CNN 10 02 48 AM From Reuters 10 02 47 AM From ONN 10 02 47 AM From ONN 10 02 48 AM From Reuters 10 02 48 AM From Reuters 10 02 48 AM From CNN 10 02 48 AM From Reuters 10 02 48 AM From Reuters 10 02 49 AM From Reuters 10 02 49 AM From ON 10 02 49 AM From Reuters 10 02 49 AM From Reuters 10 02 49 AM From Reuters 10 02 49 AM From OWN 10 02 49 AM From Reuters 10 02 50 AM From Reuters 10 02 47 AM From ONN 10 02 47 AM From CNN 10 02 48 AM From ONN 10 02 49 AM From ONN 10 02 49 AM From ONN 10 02 50 AM From Reuters 10 02 50 AM From ONN 10 02 50 AM From Reuters 10 02 50 AM From Reuters 10 02 50 AM From Reuters lores ipsum 1 _ Article 1 initially received lorem ipsum 1 lorem ipsum 2 gt lorem ipsun 3 lorem ipsum 4 lorem ipsus 2 lorem ipsum 5 Available articles as of 10 02 50 AM Lorem ipsum 1 cached lt CNN articles still available lorem ipsum 2 cached lorem ipsum 6 lores ipsus 7 lorem ipsus 3 lorem ipsun 8 loren ipsun 9 lorem ipsum 10 4 Reuters articles 1 5 expired Lorem ipsus 4 lorem ipsus 11 lorem ipsum 12 lorem ipsus 13 lorem ipsum 5 Lorem ipsum 14 lorem ipsum
114. s can participate in one or multiple domains Symmetric architecture Makes your application robust No central server or privileged nodes means your system is robust to application and or node fail ures Dynamic Topics subscriptions and publications can be added or removed from the system at any time wo2J M L M Multiple network transports RTI Data Distribution Service includes support for UDP IP IPv4 and IPv6 including for example Ethernet wireless and Infini band networks and shared memory transports It also includes the ability to dynamically plug in additional network transports and route messages over them It can be configured to operate over a variety of transport mechanisms including backplanes switched fabrics and other networking technologies Multi platform and heterogeneous system support Applications based on RTI Data Distribution Service can communicate transparently with each other regard less of the underlying operating system or hardware Consult the Release Notes to see which platforms are supported in this release Vendor neutrality and standards compliance The RTI Data Distribution Service API complies with the DDS specification On the network it supports the open DDS Interoperability Protocol Real Time Publish Subscribe RTPS which is also an open standard from the OMG What Can RTI Data Distribution Service Do Am I Better Off Building My Own Middleware Sometimes
115. s for UNIX based systems you can use the make command with this makefile L example C CPP lt example gt make Makefile lt architecture gt where lt architecture gt reflects the compiler OS and processor combination for your development environment If you do not see your architecture listed see Generating Type Support Code with rtiddsgen Section 4 3 2 1 for instructions on how to generate an example makefile 2 8 Selecting a Development Environment 2 4 2 Using the Command Line Tools on Windows Systems For Java based applications you can use the following script files to build and execute L example JAVA lt example gt build cmd Builds Java source files no parame ters are needed L example JAVA lt example gt run cmd Runs the main program Hello in either Publisher or Subscriber mode It accepts the following parameters e pub sub Run as publisher or subscriber e verbose lIncreases output verbosity This script accepts other options which we will discuss in later chapters For Java users The native libraries used by the RTI Java API require the Visual Studio 2005 service pack 1 redistributable libraries on the target machine You can obtain this package from Microsoft or RTI For C C and C users Please use Microsoft Visual Studio 2005 service pack 1 or later or Visual Studio 2008 to build and run the examples 2 4 3 Using Microsoft Visual Studio RTI Data Distribution Service include
116. s for the example code These configuration files do not depend on the language bindings and largely do not depend on the operating system either Header files for C and C APIs Java runtime environment files used by the rtiddsgen tool you do not need to use this JRE to run your own Java applications Library files Start page for accessing the HTML documentation Document format definitions and template files used by rtiddsgen RTI tools this directory should be in your path The two most important directories for learning RTI Data Distribution Service are exam ple and doc The doc directory contains the RTI Data Distribution Service library informa tion in PDF and HTML formats You may want to bookmark the HTML directory since you will be referring to this page a lot as you explore the RTI technology platform All the example code is shipped in C C Java and C You can access the example code in a language of your choice from the respective locations under the example direc tory These examples include L Hello_simple This example demonstrates one of the simplest applications you can write with RTI Data Distribution Service it does nothing but publish and sub scribe to short strings of text This example is described in detail in Chapter 3 Getting Started with RTI Data Distribution Service 2 7 UOHD D SU Z I Hello_builtin Hello_idl Hello_dynamic These examples are also very simple to run but demonstrate som
117. s in the directories NDDSHOME example lt language gt The Hello_idl and Hello_dynamic examples are in parallel directories under NDDSHOME example lt language gt The examples perform these steps 1 Parse their command line arguments 2 Check if the Quality of Service QoS file can be located The XML file that sets the Quality of Service QoS parameters is either loaded from the file USER_QOS_PROFILES xml in the current directory of the pro gram or from the environment variable NDDS_QOS_PROFILES For more information on how to use QoS profiles see the chapter on Configuring QoS with XML in the RTI Data Distribution Service User s Manual 3 On the publishing side send text strings as fast as possible prefixing each one with a serial number 4 On the subscribing side receive these strings keeping track of the highest num ber seen as well as other statistics Print these out periodically The steps for compiling and running the program are the same as mentioned in Build ing and Running Hello World Section 3 1 Run the publisher and subscriber from the NDDSHOME example lt language gt Hello_builtin directory using one of the QoS profile files provided in NDDSHOME example QoS by copying it into your current working directory with the file name USER_QOS_PROFILES xml You should see output like the following from the subscribing application Understanding the Performance Results You will see several c
118. s solutions and project files for Microsoft Visual Stu dio in example C CPP CSHARP lt example gt win32 To use these solution files 1 Start Visual Studio 2 Select File Open Project Solution 3 In the File dialog select the solution file for your architecture the solution file for Visual Studio 2005 for 32 bit platforms is example C CPP CSHARP lt example gt win32 Hello i86Win32VS2005 sIn 1 If you are using an earlier version of Visual Studio you can obtain a no cost edition of Visual Studio 2005 or 2008 from Microsoft s web site 2 9 UOHDI D SU Z 2 10 Chapter 3 Getting Started with RTI Data Distribution 3 1 Service This chapter gets you up and running with RTI Data Distribution Service First you will build and run your first RTI Data Distribution Service based application Then we ll take a step back to learn about the general concepts in the middleware and show how they are applied in the example application you ran This chapter includes E Building and Running Hello World LJ Data Distribution Service DDS 101 Next Chapter gt Chapter 4 Capabilities and Performance Building and Running Hello World Let s start by compiling and running Hello World a basic program that publishes infor mation over the network For now do not worry about understanding the code we start covering it in Chapter 4 Capabilities and Performance Use the following instructio
119. so be used during run time to detect possible losses of connectivity Ownership and Ownership Strength Along with Ownership Strength Ownership specifies if a DataReader can receive data from multiple DataWriters at the same time By default DataReaders for a given topic can receive data from any DataWriter for the same topic But you can also configure a DataReader to receive data from only one DataWriter at a time The DataWriter with the highest Owner ship Strength value will be the owner of the topic and the one whose data is delivered to DataReaders Data sent by all other DataWriters with lower Owner ship Strength will be dropped by the middleware When the DataWriter with the highest Ownership strength loses its liveliness as controlled by the Liveliness QosPolicy or misses a deadline as controlled by the Deadline QosPolicy or whose application quits dies or otherwise disconnects the middleware will change ownership of the topic to the DataWriter with the highest Ownership Strength from the remaining DataWriters This QoS policy can help you build systems that have redundant elements to safeguard against component or application failures When systems have active and hot standby components the Ownership QosPolicy can be used to ensure that data from standby applications are only delivered in the case of the failure of the primary Built in Support for Periodic Data m Deadline For a DataReader this QoS specifies the maximum
120. ssssssssissisrisrssrissiesresisstesienrenessnesnesrent 1 2 1 1 1 Reduce Risk Through Performance and Availability 0 0 0 0 ccc eens 1 2 1 1 2 Reduce Cost through Ease of Use and Simplified Deployment e 1 3 1 1 3 Ensure Success with Unmatched Flexibility 0 0 0 ccccceeeeeee ee eseeeeeeceseseeeeeees 1 3 1 1 4 Connect Heterogeneous SyStems essc arianiisi aiiiar a nr ia i iiair 1 4 1 1 5 Interoperate with Databases Event Engines and JMS Systems csceseee 1 4 What Can RTI Data Distribution Service D0 0 ee eceesesseseeseeeeseseeseseesesceceseseesesaeeceeseeeees 1 5 Installing RTI Data Distribution Service Installing RTI Data Distribution Service cccceeceeeccscsesesescseseesescecseseseecesseseseesesenseeeeseeey 2 1 2 1 1 Installing on a UNIX Based System ccccescscescscssesescseststeseseseenescscsnansnesssneneseseeees 2 2 2 1 2 Installing on a Windows System ccccecceccsseeseses cesses cscseeeseecscesseseseesessneeeeeseees 2 3 License Management incisis eei ii inana aE Aidan a ddadacnniiadaanaien 2 5 221 Optainine A License Eilersen A ogee A ont ce A EAER 2 5 22 2 Loading the License File sssiiiissisiisie siei ien sirde aini derre i E erna a Ee 2 6 2 2 3 Adding or Removing License Management ses sssssissserisrissisrssirisrisresnerreesesnes 2 6 Navigating the Directories cis 2225 n R 2 6 Selecting a Development EnvironMent cccccccceccceee ee ceeseseeeeseeseseseesesseeesneseseseseeeeee
121. sults change Compact Type Safe Data Programming with Data Types 4 3 2 4 3 2 1 Using Types Defined at Compile Time In this section we define a type at compile time using a language independent descrip tion and the RTI code generator rtiddsgen The code generator accepts data type definitions in a number of formats such as OMG IDL XML Schema XSD and a DDS specific format of XML This makes it easy inte grate RTI Data Distribution Service with your development processes and IT infrastruc ture In this chapter we will define types using IDL In case you would like to experiment with a different format rtiddsgen can convert from any supported format to any other simply pass the arguments convertToldl convertToXml convertToXsd or convertToWsdl The following sections will take your through the Hello_idl example You can find the source for this example in the directory NDDSHOME example lt languagel Hello_idl This example includes two additional steps that you have not yet encoun tered with the built in types I Defining your data type and generating code for it see Generating Type Support Code with rtiddsgen Section 4 3 2 1 LL Registering that type with RTI Data Distribution Service see Registering Data Types Section 4 3 2 2 Generating Type Support Code with rtiddsgen As mentioned you can define types at compile time using OMG s IDL XSD and WSDL and XML Do not worry about how the types are
122. ter or leave the network L Optimizing network and system resources for transmission of periodic data by supporting time based filtering of data example receive a sam ple no more than once per second and deadlines example expect to receive a sample at least once per second Writing network code to connect a few nodes is deceptively easy Making that code scale handle all the error scenarios you will eventually face work across platforms keep current with technology and adapt to unexpected future requirements is another matter entirely The initial cost of a custom design may seem tempting but beware robust architectures take years to evolve Going with a fire tested widely used design assures you the best performance and functionality that will scale with your distributed application as it matures And it will minimize the profound cost of going down the wrong path QWOTIOM L Chapter 2 Installing RTI Data Distribution Service 2 1 RTI Data Distribution Service is delivered as static and dynamic libraries with develop ment tools examples and documentation that will help you use the libraries This chapter includes E Installing RTI Data Distribution Service L License Management E Navigating the Directories E Selecting a Development Environment Next Chapter gt Getting Started with RTI Data Distribution Service Installing RTI Data Distribution Service RTI Data Distribution Service is availabl
123. that must work together in even very complex systems Interoperate with Databases Event Engines and JMS Systems RTI provides connections between its middleware core and many types of enterprise software Simple but powerful integrations with databases Complex Event Processing CEP engines and other middlewares ensure that RTI can bind together your real time and enterprise systems RTI also provides a Java Message Service JMS application programming interface RTI Data Distribution Service directly interoperates at the wire protocol level with RTI Mes sage Service the world s highest performing JMS implementation RTI Message Service with its standard JMS interface then provides integration with a wide range of enter prise service busses and application gateways For more information about interoperability with other middleware implementations including IBM MQ Series please consult your RTI account representative 1 For more information about RTI Message Service visit on RTI the web at http www rti com products jms index html For performance benchmark results see http www rti com products jms latency throughput benchmarks html What Can RTI Data Distribution Service Do 1 2 What Can RTI Data Distribution Service Do Under the hood RTI Data Distribution Service goes beyond basic publish subscribe com munication to target the needs of applications with high performance real time and or low overhead
124. twork or dropped by rout ers Switches and even the operating system of the subscribing applications when buf fers become full In reliable messaging the middleware keeps track of whether or not data sent has been received by subscribing applications and will resend data that was lost on transmission Like most reliable protocols including TCP the reliability protocol used by RTI uses additional packets on the network called metadata to know when user data packets are Reliable Messaging lost and need to be resent RTI offers the user a comprehensive set of tunable parameters that control how many and how often metadata packets are sent how much memory is used for internal buffers that help overcome intermittent data losses and how to detect and respond to a reliable subscriber that either falls behind or otherwise disconnects When users want applications to exchange messages reliably there is always a need to trade off between performance and memory requirements When strictly reliable com munication is enabled every written sample will be kept by RTI Data Distribution Service inside an internal buffer until all known reliable subscribers acknowledge receiving the sample If the publisher writes samples faster than subscribers can acknowledge receiving this internal buffer will eventually be completely filled exhausting all the available space in that case further writes by the publishing application will block Similarly
125. ue payloads but also highly structured data It provides both static and dynamic type safety without the network overhead of the self describing messages of other networking middleware implementations See Compact Type Safe Data Programming with Data Types Section 4 3 for more information I Industry leading performance RTI Data Distribution Service provides industry leading latency throughput and jitter performance Chapter 6 Design Patterns for High Performance provides specific QoS configuration examples to help you get started You can quickly see the effects of the changes you make using the code examples described in that chapter You can benchmark the performance of RTI Data Distribution Service on your own systems with the RTI Example Perfor 4 1 DUPDWIOJH d PUD s yi qodo y 4 1 4 2 mance Test You can download the test from the RTI Public Knowledge Base http www rti com kb Search for Example Performance Test for RTI Data Distribution Service For more information about this test see Chapter 7 LJ You can also review the data from several performance benchmarks here http www tti com products dds benchmarks cpp linux html Next Chapter gt Chapter 5 Design Patterns for Rapid Development Automatic Application Discovery As you ve been running the code example described in this guide you may have noticed that you have not had to start any server processes or configure any networ
126. up publishes some data and then shuts down a DataReader that subsequently starts up will not receive that data Durability like some other QoS policies has request offer semantics the DataWriter must offer a level of service that is greater than or equal to the level of service requested by the DataReader For example a DataReader may request only volatile durability while the DataWriter may offer transient durability In such a case the two will be able to commu nicate However if the situation were reversed they would not be able to communicate Running amp Verifying Run the NewsPublisher and wait several seconds Then start the NewsSubscriber Look at the time stamps printed next to the received data you will see that the subscrib ing application receives data that was published before it started up Now do the same thing again but first modify the configuration file by commenting the durability configuration You will see that the subscribing application does not receive any data that was sent prior to when it joined the network Caching Data Within the Middleware When you receive data from the middleware in your subscribing application you may be able to process all of the data immediately and then discard it Frequently however you will need to store it somewhere in order to process it later Since you ve already expressed to the middleware how long your data remains relevant see Subscribing Only to Relevant Data
127. ution that requires a license file in order to oper ate and your license file changes for example you receive a new license for a longer term than your original license you do not need to reinstall RTI Data Distribution Ser vice However if you decide to migrate from a license managed distribution of RTI Data Dis tribution Service to one of the same version that does not require license management or visa versa RTI recommends that you first uninstall your original distribution before installing your new distribution Doing so will prevent you from inadvertently using a mixture of libraries from multiple installations Navigating the Directories Once you have installed RTI Data Distribution Service you can access the example code used in this document under NDDSHOME example RTI supports the C C C CLI C and Java programming languages While we will examine the C and Java Navigating the Directories examples in the following chapters you can access similar code in the language of your choice The RTI Data Distribution Service directory tree is as follows NDDSHOME class doc example IC CPP CPPCLI CSHARP JAVA QoS include jre Nib ReadMe html resource scripts Root directory where RTI Data Distribution Service is installed Java library files Documentation in HTML and PDF format Example code in C C C CLI C and Java Quality of Service QoS configuration file
128. very large Over 1 Suppose that a physical network delivers a 1 KB frame successfully 97 of the time Now suppose that an application sends a 64 KB datagram The likelihood that all fragments will arrive at their destination is 97 to the 64th power or less than 15 6 15 SOUDWOLed YIH 10 SUI HOd UBIsEg 9 an unreliable protocol like UDP such losses will eventually lead to near total data loss as data size increases Over a protocol like TCP which provides reliability at the level of whole IP datagrams not fragments mounting losses will eventually lead to the net work filling up with repairs which will themselves be lost the result can once again be near total data loss To solve this problem you need to repair data at the granularity at which it was lost you need not message level reliability but fragment level reliability This is an impor tant feature of RTI Data Distribution Service When sending packets larger than the MTU of your underlying link use RTI s data fragmentation and asynchronous publishing fea tures to perform the fragmentation at the DDS level hence relieving the IP layer of that responsibility lt datawriter_qos gt lt publish_mode gt lt kind gt ASYNCHRONOUS_PUBLISH_MODE_QOS lt kind gt lt flow_controller_name gt DDS_DEFAULT_FLOW_CONTROLLER_NAME lt flow_controller_name gt lt publish_mode gt lt datawriter_qos gt lt participant_qos gt lt property gt lt value gt
129. y Batching is also useful when sending a large number of small samples over a connection where the bandwidth is severely constrained High Throughput for Streaming Data 6 3 1 Figure 6 4 Implementation RTI can automatically flush batches based on the maximum number of samples the total batch size or elapsed time since the first sample was placed in the batch which ever comes first Your application can also flush the current batch manually Batching is completely transparent on the subscribing side no special configuration is necessary Batching Implementation Gun ree as RTI collects samples in a batch until the batch is flushed For more information on batching see the User s Manual Section 6 5 1 or online docu mentation the Batch QosPolicy is described in the Infrastructure Module Using the batching feature is simple just modify the QoS in the publishing applica tion s configuration file For example to enable batching with a batch size of 100 samples set the following QoS in your XML configuration file lt datawriter_qos gt lt batch gt lt enable gt true lt enable gt lt max_samples gt 100 lt max_samples gt lt batch gt lt datawriter_qos gt 6 1 SOUDWOLeg YIH 10 SUId Dg UBISEg 9 To enable batching with a maximum batch size of 8K bytes lt datawriter_qos gt lt batch gt lt enable gt true lt enable gt lt max_data_bytes gt 8192 lt max_data_bytes gt

Download Pdf Manuals

image

Related Search

Related Contents

Trust 19146  Toshiba Satellite C855D-S5106    Samsung SGH-D600 Korisničko uputstvo  SEMAINE N°18 SEMAINE MARIAGE    CougarWeb User Manual for Faculty  

Copyright © All rights reserved.
Failed to retrieve file