Advanced OpenSplice Programming - Part II
Upcoming SlideShare
Loading in...5
×
 

Advanced OpenSplice Programming - Part II

on

  • 1,693 views

OpenSplice DDS enables seamless, timely, scalable and dependable data sharing between distributed applications and network-connected devices. Its technical and operational benefits have propelled ...

OpenSplice DDS enables seamless, timely, scalable and dependable data sharing between distributed applications and network-connected devices. Its technical and operational benefits have propelled adoption across multiple industries, such as Defence and Aerospace, SCADA, Gaming, Cloud Computing, Automotive, etc.

If you want to learn about OpenSplice DDS or discover some of its advanced features, this webcast is for you!

In this two-parts presentation we will cover most of the aspects tied to architecting and developing OpenSplice DDS systems. We will look into Quality of Services, data selectors concurrency and scalability concerns.

We will present the brand-new, and recently finalized, C++ and Java APIs for DDS, including examples of how this can be used with C++11 features. We will show how, increasingly popular, functional languages such as Scala can be used to efficiently and elegantly exploit the massive HW parallelism provided by modern multi-core processors.

Finally we will present some OpenSplice specific extensions for dealing very high-volumes of data – meaning several millions of messages per seconds.

Statistics

Views

Total Views
1,693
Views on SlideShare
1,646
Embed Views
47

Actions

Likes
0
Downloads
76
Comments
0

4 Embeds 47

https://twitter.com 40
http://www.icorsaro.net 5
http://dds4u.blogspot.com 1
http://icorsaro.net 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Advanced OpenSplice Programming - Part II Advanced OpenSplice Programming - Part II Presentation Transcript

  • Advanced OpenSplice DDS Programming - Part II -OpenSplice DDS Angelo CORSARO, Ph.D. Chief Technology Officer OMG DDS Sig Co-Chair PrismTech angelo.corsaro@prismtech.com
  • Part I - RecapOpenSplice DDS
  • Key Concepts to Remember ☐ OpenSplice DDS provides a mechanism for efficiently sharing user- Copyright  2011,  PrismTech  –    All  Rights  Reserved. defined data among distributed applications and network connected devicesOpenSplice DDS Agricultural Vehicle Systems Large Scale SCADA Systems Smart Cities Train Control Systems Complex Medical Devices Big Data (In-Memory) Analytics
  • Key Concepts to Remember ☐ OpenSplice DDS allows to build distributed systems by reasoning in Copyright  2011,  PrismTech  –    All  Rights  Reserved. terms of application types as opposed to messagesOpenSplice DDS TopicA TopicE ... TopicB TopicD TopicC OpenSplice DDS Global Data Space PS. long in IDL is a 32 bit integer
  • Key Concepts to Remember ☐ User defined data types are accessible through “local caches”. Copyright  2011,  PrismTech  –    All  Rights  Reserved. These local caches can have a depth and store multiple updates for the same data itemOpenSplice DDS
  • Key Concepts to Remember Copyright  2011,  PrismTech  –    All  Rights  Reserved. ☐ Built-in dynamic discovery automatically establishes associations between data writers and data readers Data Reader DataOpenSplice DDS Writer Data Reader Data TopicD Writer TopicA Data TopicB Reader Data Writer TopicC ... Data Data Writer Reader DDS Global Data Space
  • Anatomy of a DDS Application [DDS C++ API 2010] Domain Domain Copyright  2011,  PrismTech  –    All  Rights  Reserved. auto dp = DomainParticipant(domainId); Participant Session // Create a Topic Publisher Topic SubscriberOpenSplice DDS auto topic = Topic<ShapeType>(dp, “Circle”); // Create a Publisher / Subscriber auto pub = Publisher(dp); auto sub = Subscriber(dp); Reader/Writers for User Defined for Types DataWriter DataReader // Create a DataWriter/DataWriter auto writer = DataWriter<ShapeType>(pub, topic); Reader/Writer for auto reader = DataReader<ShapeType>(sub, topic); application defined Topic Types
  • Anatomy of a DDS Application [DDS C++ API 2010] Domain Domain Copyright  2011,  PrismTech  –    All  Rights  Reserved. auto  dp  =  DomainParticipant(domainId);   Participant Session //  Create  a  Topic Publisher Topic SubscriberOpenSplice DDS auto  topic  =  Topic<ShapeType>(dp,  “Circle”); //  Create  a  Publisher  /  Subscriber auto  pub  =  Publisher(dp); auto  sub  =  Subscriber(dp); Reader/Writers for User Defined for Types DataWriter DataReader //  Write  data writer.write(ShapeType(“RED”,  131,  107,  89)); Reader/Writer for //  But  you  can  also  write  like  this... application defined writer  <<  ShapeType(“RED”,  131,  107,  89); Topic Types //  Read  new  data  (loaned) auto  data  =  reader.read();
  • Anatomy of a DDS Application [DDS Java 5 API 2010] Domain Domain Copyright  2011,  PrismTech  –    All  Rights  Reserved. DomainParticipantFactory  factory  =  DomainParticipantFactory.getInstance(env); DomainParticipant  dp  =  factory.createParticipant(); Participant Session //  Create  a  Topic Topic<ShapeType>  topic  = Publisher Topic SubscriberOpenSplice DDS      dp.createParticipant(“Circle”,  ShapeType.class); //  Create  a  Publisher  /  Subscriber Publisher    pub  =  dp.createPublisher(); Subscriber  sub  =  dp.createSubscriber(); Reader/Writers for User Defined for Types DataWriter DataReader //  Create  a  DataWriter/DataWriter DataWriter<ShapeType>  dw  =pub.createDataWriter(topic);   Reader/Writer for DataReader<ShapeType>  dr  =pub.createDataReader(topic);   application defined Topic Types
  • Anatomy of a DDS Application [DDS Java 5 API 2010] Domain Domain Copyright  2011,  PrismTech  –    All  Rights  Reserved. DomainParticipantFactory  factory  =  DomainParticipantFactory.getInstance(env); DomainParticipant  dp  =  factory.createParticipant(); Participant Session //  Create  a  Topic Topic<ShapeType>  topic  = Publisher Topic SubscriberOpenSplice DDS      dp.createParticipant(“Circle”,  ShapeType.class); //  Create  a  Publisher  /  Subscriber Publisher    pub  =  dp.createPublisher(); Subscriber  sub  =  dp.createSubscriber(); Reader/Writers for User Defined for Types DataWriter DataReader //  write  data dw.write(new  ShapeType(“RED”,  10,  20,  50);   Reader/Writer for //  read  data application defined Sample.Iterator<ShapeType>  data  =  dr.read(); Topic Types
  • OpenSplice DDS Part II
  • Quality of ServiceOpenSplice DDS
  • QoS Model ☐ QoS-Policies control local and end-to-end properties of DDS Copyright  2011,  PrismTech  –    All  Rights  Reserved. Type Matching entities QoS matching QoS QoS QoS QoS QoS QoS QoS ☐ Local properties controlled by Topic Name QoS are related resource usage Publisher Subscriber ... DataWriter writes Type reads DataReader ...OpenSplice DDS ... ☐ End-to-end properties DomainParticipant DataWriter writes Type reads DataReader DomainParticipant controlled by QoS are related Topic Name to temporal and spatial aspects QoS QoS QoS of data distribution ☐ Some QoS-Policies are matched based on a Request vs. Offered Model thus QoS-enforcement
  • QoS Policies [T: Topic] [DR: DataReader] [DW: DataWriter] [P: Publisher] [S: Subscriber] [DP: Domain Participant] QoS Policy Applicability RxO Modifiable Copyright  2011,  PrismTech  –    All  Rights  Reserved. USER_DATA DP, DR, DW N Y TOPIC_DATA T N Y Configuration GROUP_DATA P, S N Y DURABILITY T, DR, DW Y NOpenSplice DDS DURABILITY T, DW N N SERVICE Data Availability HISTORY T, DR, DW N N PRESENTATION P, S Y N RELIABILITY T, DR, DW Y N PARTITION P, S N Y Data Delivery DESTINATION T, DR, DW Y N ORDER LIFESPAN T, DW N Y
  • QoS Policies [T: Topic] [DR: DataReader] [DW: DataWriter] [P: Publisher] [S: Subscriber] [DP: Domain Participant] QoS Policy Applicability RxO Modifiable Copyright  2011,  PrismTech  –    All  Rights  Reserved. DEADLINE T, DR, DW Y Y LATENCY T, DR, DW Y Y BUDGET Temporal/ TRANSPORT T, DW N Y Importance PRIORITY CharacteristicsOpenSplice DDS TIME BASED DR N Y FILTER OWNERSHIP T, DR, DW Y N OWNERSHIP DW N Y Replication STRENGTH LIVELINESS T, DR, DW Y N Fault-Detection
  • OpenSplice DDS Partition Data Delivery Reliability Presentation Data Delivery Order Destination Copyright  2011,  PrismTech  –    All  Rights  Reserved.
  • Reliability QoS Policy QoS Policy Applicability RxO Modifiable RELIABILITY T, DR, DW Y N Copyright  2011,  PrismTech  –    All  Rights  Reserved. The Reliability Policy controls the level of guarantee offered by the DDS in delivering data to subscribers ☐ Reliable. In steady-state, and no data writer crashes, theOpenSplice DDS middleware guarantees that all samples in the DataWriter history will eventually be delivered to all the DataReader ☐ Best Effort. Indicates that it is acceptable to not retry propagation of any samples
  • Setting the Reliability Policy [DDS C++ API 2010] Copyright  2011,  PrismTech  –    All  Rights  Reserved. DataWriterQos  dwqos  =        pub.default_datawriter_qos()  <<  Reliability.Reliable();OpenSplice DDS -­‐  or  -­‐ DataWriterQos  dwqos  =        pub.default_datawriter_qos()  <<  Reliability.BestEffort();
  • Setting the Partition Policy [DDS Java 5 API 2010] Copyright  2011,  PrismTech  –    All  Rights  Reserved. final  PolicyFactory  pf  =  ... DataWriterQos  dwqos  =        pub.getDefaultDataWriterQos()OpenSplice DDS            .withPolicies(pf.Reliability.withReliable());   -­‐  or  -­‐ DataWriterQos  dwqos  =        pub.getDefaultDataWriterQos()            .withPolicies(pf.Reliability.withBestEffort());  
  • Partition QoS Policy QoS Policy Applicability RxO Modifiable ☐ The Partition QoS Policy can PARTITION P, S N Y Copyright  2011,  PrismTech  –    All  Rights  Reserved. be used as subjects for organizing the flows of data ☐ The Partition QoS Policy is Subscriber used to connect Publishers/ Publisher "tracks.kfo" "tracks.ufo"OpenSplice DDS Subscribers to a Partitions’ List which might also contain wildcards, e.g. Subscriber Publisher tracks.* ☐ Topics instances are published and subscribed Publisher Subscriber across one or more Partition Partitions
  • Setting the Partition Policy [DDS C++ API 2010] Copyright  2011,  PrismTech  –    All  Rights  Reserved. PublisherQos  pqos  =        dp.default_publisher_qos()  <<  Partition(“MyPartition”);OpenSplice DDS -­‐  or  -­‐ PublisherQos  pqos  =        dp.default_publisher_qos()  <<  Partition(myPartitionList);
  • Setting the Partition Policy [DDS Java 5 API 2010] Copyright  2011,  PrismTech  –    All  Rights  Reserved. final  PolicyFactory  pf  =  ... PublisherQos  pqos  =        dp.getDefaultPublisherQos()OpenSplice DDS            .withPolicies(pf.Partition(“MyPartition”));   -­‐  or  -­‐ PublisherQos  pqos  =        dp.getDefaultPublisherQos()            .withPolicies(pf.Partition(myPartitionList));  
  • Data Availability History Copyright  2011,  PrismTech  –    All  Rights  Reserved. DataOpenSplice DDS Lifespan Durability Availability Ownership Ownership Strength
  • Durability QoS Policy QoS Policy Applicability RxO Modifiable DURABILITY T, DR, DW Y N Copyright  2011,  PrismTech  –    All  Rights  Reserved. The DURABILITY QoS controls the data availability w.r.t. late joiners, specifically the DDS provides the following variants: ☐ Volatile. No need to keep data instances for late joining data readersOpenSplice DDS ☐ Transient Local. Data instance availability for late joining data reader is tied to the data writer availability ☐ Transient. Data instance availability outlives the data writer ☐ Persistent. Data instance availability outlives system restarts
  • Volatile Data Writer Copyright  2011,  PrismTech  –    All  Rights  Reserved. 1 TopicA Data ReaderOpenSplice DDS DDS Global Data Space ‣ No Time Decoupling ‣ Readers get only data produced after they joined the Global Data Space
  • Volatile Late Joiner Data Data Reader Writer Copyright  2011,  PrismTech  –    All  Rights  Reserved. TopicA Data ReaderOpenSplice DDS 1 DDS Global Data Space ‣ No Time Decoupling ‣ Readers get only data produced after they joined the Global Data Space
  • Volatile Data Data Reader Writer Copyright  2011,  PrismTech  –    All  Rights  Reserved. 2 TopicA Data ReaderOpenSplice DDS 1 DDS Global Data Space ‣ No Time Decoupling ‣ Readers get only data produced after they joined the Global Data Space
  • Transient Local Data Writer Copyright  2011,  PrismTech  –    All  Rights  Reserved. 1 TopicA Data ReaderOpenSplice DDS DDS Global Data Space ‣ Some Time Decoupling ‣ Data availability is tied to the availability of the data writer and the history settings
  • Transient Local Late Joiner Data Data Reader Writer Copyright  2011,  PrismTech  –    All  Rights  Reserved. 1 TopicA Data ReaderOpenSplice DDS 1 DDS Global Data Space ‣ Some Time Decoupling ‣ Data availability is tied to the availability of the data writer and the history settings
  • Transient Local Data Data Reader Writer Copyright  2011,  PrismTech  –    All  Rights  Reserved. 1 1 2 TopicA Data ReaderOpenSplice DDS 1 DDS Global Data Space ‣ Some Time Decoupling ‣ Data availability is tied to the availability of the data writer and the history settings
  • Transient Data Writer Copyright  2011,  PrismTech  –    All  Rights  Reserved. 1 TopicA Data ReaderOpenSplice DDS DDS Global Data Space ‣ Time Decoupling ‣ Data availability is tied to the availability of the durability service -- a fully distributed fault-tolerant service in the case of OpenSplice DDS.
  • Transient Late Joiner Data Data Reader Writer Copyright  2011,  PrismTech  –    All  Rights  Reserved. TopicA 1 Data ReaderOpenSplice DDS 1 DDS Global Data Space ‣ Time Decoupling ‣ Data availability is tied to the availability of the durability service -- a fully distributed fault-tolerant service in the case of OpenSplice DDS.
  • Transient Data Reader Copyright  2011,  PrismTech  –    All  Rights  Reserved. 1 TopicA 1 Data ReaderOpenSplice DDS 1 DDS Global Data Space ‣ Time Decoupling ‣ Data availability is tied to the availability of the durability service -- a fully distributed fault-tolerant service in the case of OpenSplice DDS.
  • Transient Data Reader Copyright  2011,  PrismTech  –    All  Rights  Reserved. 1 TopicA 1 Data ReaderOpenSplice DDS 1 Data Reader DDS Global Data Space Late Joiner ‣ Time Decoupling ‣ Data availability is tied to the availability of the durability service -- a fully distributed fault-tolerant service in the case of OpenSplice DDS.
  • History QoS Policy QoS Policy Applicability RxO Modifiable HISTORY T, DR, DW N N Copyright  2011,  PrismTech  –    All  Rights  Reserved. For DataWriters, the HISTORY QoS policy controls the amount of data that can be made available to late joining DataReaders under TRANSIENT_LOCAL DurabilityOpenSplice DDS For DataReader, the HISTORY QoS policy controls how many samples will be kept on the reader cache ☐ Keep Last. DDS will keep the most recent “depth” samples of each instance of data identified by its key ☐ Keep All. The DDS keep all the samples of each instance of data identified by its key -- up to reaching some configurable resource limits
  • Ownership QoS Policy QoS Policy Applicability RxO Modifiable OWNERSHIP T, DR, DW Y N STRENGTH DW N Y Copyright  2011,  PrismTech  –    All  Rights  Reserved. Availability of data producers can be controlled via two QoS Policies ☐ OWNERSHIP (SHARED vs. EXCLUSIVE)OpenSplice DDS ☐ OWNERSHIP STRENGTH ☐ Instances of exclusively owned Topics can be modified (are owned) by the higher strength writer ☐ Writer strength is used to coordinate replicated writers
  • Temporal Properties Copyright  2011,  PrismTech  –    All  Rights  Reserved. TimeBasedFilter Deadline [Inbound]OpenSplice DDS Throughput LatencyBudget Latency [Outbound] TransportPriority
  • Latency Budget QoS Policy QoS Policy Applicability RxO Modifiable LATENCY T, DR, DW Y Y ☐ The LATENCY_BUDGET QoS BUDGET Copyright  2011,  PrismTech  –    All  Rights  Reserved. policy specifies the maximum acceptable delay from the time the data is written until the dataOpenSplice DDS is inserted in the receivers application-cache Latency = T1+T2+T3 DataWriter T3 DataReader ☐ A non-zero latency-budget T1 allows a DDS Batching implementation to batch T2 samples and improve CPU/ Network utilization
  • Deadline QoS Policy QoS Policy Applicability RxO Modifiable DEADLINE T, DR, DW Y Y Copyright  2011,  PrismTech  –    All  Rights  Reserved. ☐ The DEADLINE QoS policy allows to define the maximum inter-arrival time between data samples ☐ DataWriter indicates that the application commits to write a newOpenSplice DDS value at least once every deadline period ☐ DataReaders are notified by the DDS when the DEADLINE QoS contract is violated DataWriter Deadline Deadline Deadline Deadline Deadline DataReader Deadline Violation
  • Transport Priority QoS Policy QoS Policy Applicability RxO Modifiable TRANSPORT T, DW N Y PRIORITY Copyright  2011,  PrismTech  –    All  Rights  Reserved. ☐ The TRANSPORT_PRIORITY QoS policy is a hint to the infrastructure asOpenSplice DDS to how to set the priority of the underlying transport used to send the data.
  • Time-Based Filter QoS Policy QoS Policy Applicability RxO Modifiable TIME BASED DR N Y FILTER Copyright  2011,  PrismTech  –    All  Rights  Reserved. mit mit ☐ The Time Based Filter allows to control the throughput at which Latency = T1+T2+T3 data is received by a data readerOpenSplice DDS DataWriter T3 DataReader ☐ Samples produced more often T2 than the minimum inter-arrival time are not delivered to the data reader mit mit mit = minimum inter-arrival time produced sample delivered sample discarded sample
  • QoS Provider ☐ The new C++ and Java APIs introduce the concept of a QoS Copyright  2011,  PrismTech  –    All  Rights  Reserved. Provider ☐ This class allows to externally define policies and decouples the mechanism used to define and access policy definition with policyOpenSplice DDS creation            //  QosProvider...            QosProvider  qos_provider(                        "http://www.opensplice.org/demo/config/qos.xml",                        "ishapes-­‐profile");            DataReader<ShapeType>  dr(sub,  topic,  qos_provider.datareader_qos());
  • QoS and Data ModelingOpenSplice DDS Patterns
  • Soft State ☐ In distributed systems you often need to model soft-state -- a state Copyright  2011,  PrismTech  –    All  Rights  Reserved. that is periodically updated ☐ Examples are the reading of a sensor (e.g. Temperature Sensor), the position of a vehicle, etc.OpenSplice DDS ☐ The QoS combination to model Soft-State is the following: Reliability            =>    BestEffort Durability              =>    Volatile   History                    =>    KeepLast(n)  [with  n  =  1  in  most  of  the  cases] Deadline                  =>    updatePeriod LatencyBudget        =>    updatePeriod/3  [rule  of  thumb] DestinationOrder  =>    SourceTimestamp  [if  multiple  writers  per  instance]
  • Hard State ☐ In distributed systems you often need to model hard-state -- a state Copyright  2011,  PrismTech  –    All  Rights  Reserved. that is sporadically updated and that often has temporal persistence requirements ☐ Examples are system configuration, a price estimate, etc.OpenSplice DDS ☐ The QoS combination to model Hard-State is the following: Reliability            =>    Reliable Durability              =>    Transient  |  Persistent   History                    =>    KeepLast(n)  [with  n  =  1  in  most  of  the  cases] DestinationOrder  =>    SourceTimestamp  [if  multiple  writers  per  instance]
  • Events ☐ In distributed systems you often need to model events -- the occurrence of something noteworthy for our system Copyright  2011,  PrismTech  –    All  Rights  Reserved. ☐ Examples are a collision alert, the temperature beyond a given threshold, etc.OpenSplice DDS ☐ The QoS combination to model Events is the following: Reliability            =>    Reliable Durability              =>    any                [depends  on  system  requirements]   History                    =>    KeepAll  [on  both  DataWriter  and  DataReader!] DestinationOrder  =>    SourceTimestamp
  • Streams Copyright  2011,  PrismTech  –    All  Rights  Reserved. ☐ At times you need to deal with high volumes of frequently changing soft-state ☐ You may have from several hundreds of thousands to severalOpenSplice DDS millions of data readings that need to be distributed in your system... Where each reading is usually from few tends to few hundreds of bytes ☐ OpenSplice provide a special abstraction to deal with this situation called Streams
  • Streams struct SCADASensor { long sid; float value; }; #pragma stream SCADASensor ☐ OpenSplice Streams Copyright  2011,  PrismTech  –    All  Rights  Reserved. transparently perform batching and un- High Frequency High Frequency batching of data based Samples Samples on samples count orOpenSplice DDS time StreamDataWriter StreamDataReader ☐ OpenSplice Streams Batching Un-Batching also provide explicit Temporal or Samples-Count flush operation to force Driven Batching the middleware to send data
  • StreamDataWriter Copyright  2011,  PrismTech  –    All  Rights  Reserved. StreamDataWriterQos  sqos(max_samples,  max_delay); SCADASensorStreamDataWriter  sdw  =        new  SCADASensorStreamDataWriter(did,  sqos,  “ScadaSensorT”);OpenSplice DDS StreamId  sid  =  0;  //  Your  stream  Id SCADASensor  data  =  ... sdw.append(sid,  data); ... //  Explicitely  flush  the  stream sdw.flush(sid);
  • StreamDataReader Copyright  2011,  PrismTech  –    All  Rights  Reserved. SCADASensorStreamDataReader  sdr  =        new  SCADASensorStreamDataReader(did,  “ScadaSensorT”); StreamId  sid  =  0;  //  Your  stream  Id SCADASensorSeq  data;OpenSplice DDS //  Issue  a  blocking  get sdw.get(sid,  data,  DDS::LENGTH_UNLIMITED,  DDS::DURATION_INFINITE); //  Note:   //    -­‐  get_with_filter  is  also  available  to  filter  data //    -­‐  The  Stream  Examples  are  shown  using  the  DDS  C++  2004  API   //        since  these  are  OpenSplice  specific  extensions.   //        DDS  C++  2010  counterparts  will  be  soon  available.
  • Resource ManagementOpenSplice DDS
  • LongVariable Example ☐ The “distributed” version of the following code: Copyright  2011,  PrismTech  –    All  Rights  Reserved. int  x; int  y; x  =  10; y  =  20;OpenSplice DDS Topic Type ☐ Becomes: // Create a Publisher struct LongVariable { auto lvt = Topic<LongVariable>(dp, “TLongVariable”); @Key string name; // Create DataWriters long value; auto dw = DataWriter<LongVariable>(pub, topic); }; // Write Data dw.write(LongVariable(“x”,10)); dw.write(LongVariable(“y”,20)); PS. long in IDL is a 32 bit integer
  • Looking with the Spyglass Copyright  2011,  PrismTech  –    All  Rights  Reserved. Topic TLongValue struct LongVariable { @Key string name; long value;OpenSplice DDS dw }; Policies name value x 10 y 20
  • Declaration vs. Assignement Copyright  2011,  PrismTech  –    All  Rights  Reserved. Assignment {   Declaration    int  x; dw.write(LongVariable(“x”,10));    x  =  10; AssignmentOpenSplice DDS } Resources Reclamation ☐ Can we declare topic instances in DDS? ☐ Can we control resource reclamation?
  • Instance Registration Copyright  2011,  PrismTech  –    All  Rights  Reserved. {   auto key = LongVariable(“x”,0) Declaration    int  x; auto handle = Declaration    x  =  10; dw.register_instance(key); AssignmentOpenSplice DDS } dw.write(LongVariable(“x”,10)); Assignment Resources Reclamation ☐ Instance registration provides a way of informing the system that the given data writer will be writing the given instance ☐ This operation has an impact on instance life-cycle ☐ The write operation implicitly register the instance being written, if necessary
  • Instance Un-registration ☐ DDS provides a way for a DataWriter to “un-register” an Copyright  2011,  PrismTech  –    All  Rights  Reserved. instance thus informing the system that he won’t be writing that specific instance any more This operation has an impact on instance life-cycleOpenSplice DDS ☐ dw.unregister_instance(handle);
  • Instance Disposal auto key = LongVariable(“x”,0) {   Declaration auto handle = Copyright  2011,  PrismTech  –    All  Rights  Reserved. Declaration    int  x; dw.register_instance(key);    x  =  10; } Assignment dw.write(LongVariable(“x”,10)); dw.dispose_instance(handle) AssignmentOpenSplice DDS Resources Reclamation Resources Reclamation ☐ Allows to control resource reclamation for a given instance. ☐ The action of disposing an instance signifies that the system is done with it...
  • Writer Data Lifecycle The life-cycle of data on the Writer side is controlled by means of Copyright  2011,  PrismTech  –    All  Rights  Reserved. ☐ QoS policy we’ve not introduced yet, the WriterDataLifecycle ☐ This policy controls wether unregistered instances are automaticallyOpenSplice DDS disposed or not ☐ This is quite important since when a writer is disposed all its instances are automatically unregistered and depending on the setting of this QoS might also be disposed... Which in some cases is not what you want!
  • Reader Data Lifecycle ☐ The lifecycle of the data-instances received by the DataReader is Copyright  2011,  PrismTech  –    All  Rights  Reserved. controlled by the ReaderDataLifecycle policy ☐ This policy allow to control two properties ☐ autopurge_nowriter_samples_delay: the maximum duration forOpenSplice DDS which the DataReader will maintain information on an instance once its state becomes NOT_ALIVE_NO_WRITERS ☐ autopurge_disposed_samples_delay: the maximum duration for which the DataReader will maintain samples for an instance once its state becomes NOT_ALIVE_DISPOSED PS. The default setting for this policy is INFINITE for both delays
  • DDS and Functional ProgrammingOpenSplice DDS
  • Why Functional Programming (FP)? Some of the main reasons for the steep increase in the adoption of Functional Copyright  2011,  PrismTech  –    All  Rights  Reserved. Programming languages are: ☐ Referential Transparency (no side effects): makes it easier to write reusable code and facilitates concurrency (increasingly more important due to multi- cores)OpenSplice DDS ☐ Declarative style: makes code easier to understand (once you understand the language) ☐ Higher Order abstractions: Higher order functions, pattern matching, algebraic data types, Higher Kinds, makes it easier to express solutions in our domain ☐ Domain Specific Languages (DSL): Functional programming languages like Haskel and Scala make it easy to develop DSLs
  • Why DDS and FP? ☐ Data Centricity and Stream Computing match very naturally with Copyright  2011,  PrismTech  –    All  Rights  Reserved. functional programming ☐ All of a sudden your system can be easily modeled as streams of data transformed by composable functionsOpenSplice DDS ☐ Referential transparency makes it easily parallelizable F(x) G(y,z)
  • struct  TempSensor  { Example      long  id;      float  temp;      float  hum; }; #pragma  keylist  TempSensor  id Compute the moving average for temperature and humidity Copyright  2011,  PrismTech  –    All  Rights  Reserved. ☐ val  tst    =  Topic[TempSensor]("TempSensorT") val  atst  =  Topic[TempSensor]("AverageTempSensorT")OpenSplice DDS val  rqos  =  DataReaderQos()  <=  History.KeepLast(windowSize) val  dr  =  DataReader[TempSensor](tst,  rqos) val  dw  =  DataWriter[TempSensor](atst) reader.reactions  +=  {    case  DataAvailable(_)  =>  {                val  window  =  dr.history.data        val  tempAvg  =  (0F  /:  window)(_  +  _.temp)  /  window.length        val  humAvg    =  (0F  /:  window)(_  +  _.hum)  /  window.length        dw  !  new  TempSensor(-­‐1,  tempAvg,  humAvg)      } }
  • List ComprehensionOpenSplice DDS
  • List Comprehension in DDS Copyright  2011,  PrismTech  –    All  Rights  Reserved. ☐ When using the SCALA API, the DDS readers expose data as LinearSeqOptimized thus making possible list comprehension to address quite a few taskOpenSplice DDS ☐ Example ☐ dr read foreach (println) ☐ dr read map (transformer) ☐ ...
  • Examples Compute the average shape and write it as a Gray Square: Copyright  2011,  PrismTech  –    All  Rights  Reserved. ☐ val data = dr history val s0 = new ShapeType(“GRAY”, 0, 0 ,0)OpenSplice DDS dw ! scaleShape((s0 /: data) (sumShape), data.size) ☐ Filter samples: (dr read) filter (_.x <= 100 && _.y <= 200)
  • OpenSplice DDS References
  • DDS ISO C++ API 2010 Copyright  2011,  PrismTech  –    All  Rights  Reserved. ☐ github.com/kydos ☐ New C++ APIOpenSplice DDS ☐ Demo applications ☐ Alpha reference implementation (simd-cxx) ☐ online docs ☐ kydos.github.com/dds-psm-cxx/
  • OpenSplice DDS ☐ ☐ ☐ New Java API github.com/kydos Demo applications DDS Java 5 API 2010 Copyright  2011,  PrismTech  –    All  Rights  Reserved.
  • DDS Scala API Copyright  2011,  PrismTech  –    All  Rights  Reserved. ☐ github.com/kydos ☐ Scala API for DDS Set of demo showing howOpenSplice DDS ☐ the API can be used ☐ Notice that this API can also be used for scripting DDS applications
  • OpenSplice DDS Summing Up
  • Concluding Remarks OpenSplice DDS provides a very powerful abstraction for building Copyright  2011,  PrismTech  –    All  Rights  Reserved. ☐ distributed applications grounded on the concept of a fully distributed global data spaceOpenSplice DDS ☐ Topics are used to define the types that populate the global data space while DataWriters and DataReaders are used to produce and consume values ☐ DataReaders allow very flexible data access through cache access operations
  • OpenSplice DDS
  • References Copyright  2011,  PrismTech  –    All  Rights  Reserved. OpenSplice | DDS Escalier ¥ #1 OMG DDS Implementation ¥ Fastest growing JVM Language ¥ Scala API for OpenSplice DDS ¥ Open Source ¥ Open Source ¥ Open Source ¥ www.opensplice.org ¥ www.scala-lang.org ¥ github.com/kydos/escalierOpenSplice DDS ¥ Simple C++ API for DDS ¥ DDS-PSM-Java for OpenSplice DDS ¥ DDS-based Advanced Distributed ¥ Open Source ¥ Open Source Algorithms Toolkit ¥ github.com/kydos/simd-cxx ¥ github.com/kydos/simd-java ¥ Open Source ¥ github.com/kydos/dada
  • :: Connect with Us :: ¥opensplice.com ¥forums.opensplice.org ¥@acorsaro ¥opensplice.org ¥opensplicedds@prismtech.com ¥@prismtechOpenSplice DDS ¥ crc@prismtech.com ¥sales@prismtech.com ¥youtube.com/opensplicetube ¥slideshare.net/angelo.corsaro