Sie sind auf Seite 1von 74

Mastering DDS QoS

Copyright PrismTech, 2017


Angelo Corsaro, PhD
CTO, ADLINK Tech. Inc.
Co-Chair, OMG DDS-SIG
angelo.corsaro@adlinktech.com
DDS Refresher

Copyright PrismTech, 2017


DDS Abstraction
Data
Data Reader
Writer

Copyright PrismTech, 2017


DDS provides Data
QoS Data
TopicD Reader
applications with Writer
QoS
a Virtual Global TopicA
Data
Data Space Data QoS Reader
Writer
abstraction QoS
TopicB
...
TopicC
Data Data
Writer Reader

DDS Global Data Space


DDS Abstraction
Data
Data Reader
Applications Writer

Copyright PrismTech, 2017


coordinate by
QoS Data
autonomously and Data TopicD Reader
Writer
asynchronously QoS
TopicA
reading and Data
writing data in the Data
Writer TopicB
QoS Reader

Data Space QoS


...
TopicC
enjoying spatial
Data Data
and temporal Writer Reader

decoupling DDS Global Data Space


Topics
Data
Data Reader
Writer

QoS Data

DDS data streams are


Data TopicD Reader
Writer
QoS

Copyright PrismTech, 2017


defined by means of
TopicA
Data
Data QoS Reader

Topics
Writer TopicB
QoS
...
TopicC
Data Data
Writer Reader

A Topic represented is DDS Global Data Space


“LightBulb”
by means of a <name,
type, qos>
Name
struct LightBulbState {
string sn; Topic “
Reliability,

Typ

S
float luminosity; Durability

Qo
long hue; ...
boolean on; e ”
};
#pragma keylist LightBulgState sn
Topic Instances
Topic may mark some of their
associated type attributes as key-

Copyright PrismTech, 2017


fields

Each unique key value (tuple of key


attributes) identifies a Topic
Instance. Each Topic Instance has
associated a FIFO ordered stream of
samples

DDS provides useful instance life-


cycle management and samples
demultiplexing
Topics and Relations
A topic cans be seen as

Copyright PrismTech, 2017


defining a relation

struct LightBulbState { sn luminosity hue on


string sn;
a123-21ef 0.5 12750 TRUE
float luminosity;
long hue; 600d-caf3 0.8 46920 FALSE
boolean on; 1234-c001 0.75 25500 TRUE
};
#pragma keylist LightBulgState sn
DDS Entities

Copyright PrismTech, 2017


DDS Entities
DDS provides three different Domain Domain
entities to control where and

Copyright PrismTech, 2017


Participant Participant
Joins Domain Joins
what data is read/written
Partitions
The DomainParticipant, Publisher
Produces
Topic
Consumes
From Subscriber
Into
Publisher and Subscriber
relate to the “where”

DataReader and DataWriter Writes Reads


DataWriter DataReader
relate to the “what”
DDS Entities
DDS QoS Policies control, Domain Domain

at a large extent, to the

Copyright PrismTech, 2017


Participant Participant
Joins Domain Joins

“how” data is shared


Partitions
Produces Consumes
Topic
QoS Policies also control
Publisher Subscriber
Into From

resource utilisation

Writes Reads
DataWriter DataReader
Matching Model
For data to flow from a
DataWriter (DW) to one or Domain Domain

many DataReader (DR) a few


Participant Participant
Joins Domain Joins

Copyright PrismTech, 2017


conditions have to apply: Partition
Consumes
The DR and DW have to be in Publisher
Produces
Into
Topic
From Subscriber

the same domain

The partition expression of the


DR’s Subscriber and the DW’s DataWriter
Writes Reads
DataReader
Publisher should match (in terms
of regular expression match) Offered
QoS
RxO QoS Policies Requested
QoS
Policies Policies
The QoS Policies offered by the QoS Policy
DW should exceed or match
those requested by the DR
Storage Model
DataWriter and DataReaders Domain
Participant
Domain
Participant
Joins Domain
have an associated samples Joins

Copyright PrismTech, 2017


cache Partition
Produces Consumes
Publisher Topic Subscriber
From
In a sense, what DDS does is to
Into

project, eventually, the relevant


content of the writer cache into
Writes Reads
matching reader caches DataWriter DataReader

Offered RxO QoS Policies Requested


As a consequence of these QoS QoS
Policies Policies
caches reads and writes are QoS Policy
always local and non-blocking*

* reads never block and a write will only block, depending on QoS settings if sufficient resources are not available
QoS Policies
DDS QoS Policies
DDS provides 20+ DURABILITY LIVELINESS DEST. ORDER TIME-BASED FILTER

Copyright PrismTech, 2017


standard QoS HISTORY OWENERSHIP PARTITION RESOURCE LIMITS
Policies LIFESPAN OWN. STRENGTH PRESENTATION
RELIABILITY DW LIFECYCLE
While this may seem DEADLINE
USER DATA DR LIFECYCLE
a lot of complexity LATENCY BUDGET
TOPIC DATA ENTITY FACTORY
they are often used
GROUP DATA TRANSPORT PRIO
in combination to
achieve certain
patterns Immutable RxO QoS Local QoS
RxO Model
Domain Domain
Participant Participant
Joins Domain Joins
A subset of the QoS
Policies impact the Produces
Partitions
Consumes
Topic
matching
Publisher Subscriber
From

Copyright PrismTech, 2017


Into

Most of thee QoS relate to Writes Reads

end-to-end properties of DataWriter DataReader

data
RxO QoS Policies

DURABILITY
DEST. ORDER
offered RELIABILITY requested
QoS QoS
LATENCY BUDGET
DEADLINE
OWENERSHIP
LIVELINESS
PRESENTATION
QoS Policies
Domain Participant
DURABILITY
LIVELINESS
HISTORY
OWENERSHIP
LIFESPAN
OWN. STRENGTH

Copyright PrismTech, 2017


DEST. ORDER
DEADLINE
PARTITION
Domain LATENCY BUDGET
PRESENTATION
Participant TRANSPORT PRIO
RELIABILITY

TIME-BASED FILTER
USER DATA
RESOURCE LIMITS
TOPIC DATA
GROUP DATA
DW LIFECYCLE

DR LIFECYCLE

ENTITY FACTORY

RxO QoS Local QoS Not Applicable

Immutable
QoS Policies
Topic
DURABILITY
LIVELINESS
HISTORY
OWENERSHIP
LIFESPAN
OWN. STRENGTH

Copyright PrismTech, 2017


DEST. ORDER
DEADLINE
PARTITION
LATENCY BUDGET
PRESENTATION Topic
TRANSPORT PRIO
RELIABILITY

TIME-BASED FILTER
USER DATA
RESOURCE LIMITS
TOPIC DATA

GROUP DATA
DW LIFECYCLE

DR LIFECYCLE

ENTITY FACTORY

RxO QoS Local QoS Not Applicable

Immutable
QoS Policies
Publisher
DURABILITY
LIVELINESS
HISTORY
OWENERSHIP
LIFESPAN
OWN. STRENGTH

Copyright PrismTech, 2017


DEST. ORDER
DEADLINE
PARTITION
LATENCY BUDGET
PRESENTATION Publisher
TRANSPORT PRIO
RELIABILITY

TIME-BASED FILTER
USER DATA
RESOURCE LIMITS
TOPIC DATA

GROUP DATA
DW LIFECYCLE

DR LIFECYCLE

ENTITY FACTORY

RxO QoS Local QoS Not Applicable

Immutable
QoS Policies
Subscriber
DURABILITY
LIVELINESS
HISTORY
OWENERSHIP
LIFESPAN
OWN. STRENGTH

Copyright PrismTech, 2017


DEST. ORDER
DEADLINE
PARTITION
LATENCY BUDGET
PRESENTATION Subscriber
TRANSPORT PRIO
RELIABILITY

TIME-BASED FILTER
USER DATA
RESOURCE LIMITS
TOPIC DATA

GROUP DATA
DW LIFECYCLE

DR LIFECYCLE

ENTITY FACTORY

RxO QoS Local QoS Not Applicable

Immutable
QoS Policies
DataWriter
DURABILITY
LIVELINESS
HISTORY
OWENERSHIP
LIFESPAN
OWN. STRENGTH

Copyright PrismTech, 2017


DEST. ORDER
DEADLINE
PARTITION
LATENCY BUDGET
PRESENTATION DataWriter
TRANSPORT PRIO
RELIABILITY

TIME-BASED FILTER
USER DATA
RESOURCE LIMITS
TOPIC DATA
GROUP DATA
DW LIFECYCLE

DR LIFECYCLE

ENTITY FACTORY

RxO QoS Local QoS Not Applicable

Immutable
QoS Policies
Data Reader
DURABILITY
LIVELINESS
HISTORY
OWENERSHIP
LIFESPAN
OWN. STRENGTH

Copyright PrismTech, 2017


DEST. ORDER
DEADLINE
PARTITION
LATENCY BUDGET
PRESENTATION DataReader
TRANSPORT PRIO
RELIABILITY

TIME-BASED FILTER
USER DATA
RESOURCE LIMITS
TOPIC DATA
GROUP DATA
DW LIFECYCLE

DR LIFECYCLE

ENTITY FACTORY

RxO QoS Local QoS Not Applicable

Immutable
QoS Categorisation
Data Delivery
Ownership
Reliability Ownership
Strength

Copyright PrismTech, 2017


Destination
Partition Data Delivery Order

Presentation
Temporal Properties
TimeBasedFilter Deadline

Copyright PrismTech, 2017


[Inbound]

Throughput LatencyBudget Latency


[Outbound]

TransportPriority
Data Availability
History

Copyright PrismTech, 2017


Lifespan Data Availability Durability

Durabiliy
Service
Writer Cache
History Lifespan

Copyright PrismTech, 2017


Resource
Durability Writer Cache Limits

Writer Data
Reliability
Lifecycle
Reader Cache

Copyright PrismTech, 2017


History

Destination Resource
Order
Reader Cache Limits

Reader Data
Lifecycle
QoS Semantics
History
History
The HISTORY QoS Policy

Copyright PrismTech, 2017


DataReader/DataWriter
provide controls on the
replacement strategy and
...
depth of the cache

Cache

QoS Policy Applicability RxO Modifiable

HISTORY T, DR, DW N N
Data Writer History
KeepLast(1)

The DataWriter HISTORY QoS

Copyright PrismTech, 2017


Policy controls the amount of time

data that can be made


available to late joining time

DataReaders
under TRANSIENT_LOCAL KeepLast(3)

Durability time
KeepAll

QoS Policy Applicability RxO Modifiable

HISTORY T, DR, DW N N
DataReader History
The DataReader HISTORY QoS KeepLast(1)
Policy controls how many
samples will be kept on the

Copyright PrismTech, 2017


time
reader cache
time
Keep Last. DDS will keep the most
recent “depth” samples of each
instance of data identified by its key KeepLast(3)

time
Keep All. The DDS keep all the KeepAll
samples of each instance of data
identified by its key -- up to reaching
some configurable resource limits
QoS Policy Applicability RxO Modifiable

HISTORY T, DR, DW N N
History: Another Perspective

As we saw earlier a topic can

Copyright PrismTech, 2017


be seen as a relation (in the sn luminosity hue on

sense of relational algebra) a123-21ef 0.7 12750 TRUE


600d-caf3 0.4 46920 FALSE
sn 1234-c001
luminosity 0.75
hue 25500
on TRUE
The history makes the table a sn
a123-21ef luminosity
0.5 hue
12750 on
TRUE
cube, where each slice of the 600d-caf3
a123-21ef 0.50.8 46920 TRUE
12750 FALSE
cube represents a value of the 1234-c001
600d-caf3 0.80.75 25500 FALSE
46920 TRUE

relation at some point in time 1234-c001 0.75 25500 TRUE


Durability

Copyright PrismTech, 2017


Durability
The DURABILITY QoS controls the data availability w.r.t. late

Copyright PrismTech, 2017


joiners, specifically the DDS provides the following variants:
Volatile. No need to keep data instances for late joining data readers

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

QoS Policy Applicability RxO Modifiable

DURABILITY T, DR, DW Y N
Volatile Durability
Data

Copyright PrismTech, 2017


Writer
1 QoS
TopicA
Data
Reader

No Time Decoupling

Readers get only data produced after they joined the Global Data Space
Volatile Durability Late Joiner

Data
Reader

Data

Copyright PrismTech, 2017


Writer
QoS
2
TopicA
Data
Reader
1

No Time Decoupling
Readers get only data produced after they joined the Global Data Space
Transient Local
Data

Copyright PrismTech, 2017


Writer
1 QoS
TopicA
Data
Reader

Some Time Decoupling


Data availability is tied to the availability of the data writer and the history settings
Transient Local Late Joiner

Data
Reader

Data

Copyright PrismTech, 2017


Writer
1 QoS
TopicA
Data
Reader
1

Some Time Decoupling


Data availability is tied to the availability of the data writer and the history settings
Transient Local Late Joiner

Data
Reader

Copyright PrismTech, 2017


QoS
TopicA
Data
Reader
1

Some Time Decoupling


Data availability is tied to the availability of the data writer and the history settings
Transient Local Late Joiner

Data
Reader

Copyright PrismTech, 2017


QoS
TopicA
Data
Reader
1

This late joiner will


Data
not get any data as
Reader the writer is gone…

Some Time Decoupling


Data availability is tied to the availability of the data writer and the history settings
Transient Durability
Data

Copyright PrismTech, 2017


Writer
1 QoS
TopicA
Data
1 Reader

Time Decoupling
Data availability is tied to the availability of the durability service
Transient Durability Late Joiner

Data
Reader

Data

Copyright PrismTech, 2017


Writer
QoS
TopicA
Data
1 Reader
1

Time Decoupling
Data availability is tied to the availability of the durability service
Transient Durability Late Joiner

Data
Reader

Data 1

Copyright PrismTech, 2017


Writer
QoS
2
TopicA
Data
2 1 Reader
1

Time Decoupling
Data availability is tied to the availability of the durability service
Transient Durability Late Joiner

Data
Reader

2 1

Copyright PrismTech, 2017


QoS
TopicA
Data
2 1 Reader
2 1

Time Decoupling
Data availability is tied to the availability of the durability service
Transient Durability Late Joiner

Data
Reader

2 1

Copyright PrismTech, 2017


QoS
TopicA
Data
2 1 Reader
2 1

Data
Reader

Late Joiner
Time Decoupling
Data availability is tied to the availability of the durability service
Reliability

Copyright PrismTech, 2017


Data Reliability
The RELIABILITY QoS Policy controls one of the dimensions

Copyright PrismTech, 2017


of reliability in DDS

Yet, the full semantics of DDS reliability is controlled by a


combination of the RELIABILITY and the HISTORY QoS

QoS Policy Applicability RxO Modifiable

RELIABILITY T, DR, DW Y N
Best Effort
RELIBILITY = BEST EFFORT

DDS will deliver an arbitrary subsequence of the samples

Copyright PrismTech, 2017


written against a Topic Instance

Samples may be dropped because of network loss or


because of flow-control
Last n-values Reliability
RELIABILITY = RELIABLE
HISTORY = KEEP_LAST(n)
Under stationary conditions an application is guaranteed to receive the
last n-samples written for a Topic Instance

Copyright PrismTech, 2017


Samples falling outside the history may be dropped at the sending or
receiving side for flow/resource control

Notice that this kind of reliability behaves as a circuit breaker for slow
consumers
Reliable
RELIABILITY = RELIABLE
HISTORY = KEEP_ALL

All samples written against a Topic Instance are

Copyright PrismTech, 2017


delivered. Since from a theoretical perspective
reliability in asynchronous systems either violate progress
or requires infinite memory, DDS provides QoS to control
both resources as well as blocking time
Memory…

Copyright PrismTech, 2017


Resource Limits
The Resource Limits QoS Policy
controls the maximum size of the
DataReader and DataWriter DataReader/DataWriter
cache through three parameters

Copyright PrismTech, 2017


max_samples: max number of samples ...
the cache may hold

max_instances: max number of Cache


instances the cache may hold

max_samples_ per_instance: max


number of samples allowed per
instance
QoS Policy Applicability RxO Modifiable

RESOURCE LIMITS T, DR, DW N N


ReaderData Lifecycle
Configures the purge delay for
instances that have no writer or which DataReader

Copyright PrismTech, 2017


have been disposed
...
This is controlled through the
autopurge_nowriter_samples _delay
and the Cache
autopurge_disposed_samples_delay
parameters

For both parameters the default delay


is infinite

QoS Policy Applicability RxO Modifiable


READER DATA
DR N Y
LIFECYCLE
WriterData Lifecycle
Controls whether unregistered DataWriter

Copyright PrismTech, 2017


instances are automatically disposed
or not ...
This is controlled through the
autodispose_unregistered_instance Cache
parameter

This parameter is set to true by


default

QoS Policy Applicability RxO Modifiable


WRITER DATA
DW N Y
LIFECYCLE
Fault-Tolerance

Copyright PrismTech, 2017


Ownership
Availability of data producers can be controlled via two

Copyright PrismTech, 2017


QoS Policies:
OWNERSHIP (SHARED vs. EXCLUSIVE)

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

QoS Policy Applicability RxO Modifiable


OWNERSHIP T, DR, DW Y N
OWNERSHIP
DW N Y
STRENGTH
Fault-Masking
The Ownership can be used as a
fault-masking mechanism that

Copyright PrismTech, 2017


Source
allow to replicate Sources and
transparently switch over when a Source t
failure occurs Sink t
At any point in time the “active”
source is the one with the highest
strength. Where the strength is an
integer parameter controller by
the user
Temporal Properties

Copyright PrismTech, 2017


Latency Budget
The LATENCY_BUDGET QoS
policy specifies the maximum
acceptable delay from the

Copyright PrismTech, 2017


time the data is written until
the data is inserted in the
receiver's application-cache

A non-zero latency-budget
allows a DDS implementation
to batch samples and improve
CPU/Network utilisation

QoS Policy Applicability RxO Modifiable

LATENCY BUDGET T, DR, DW Y Y


Deadline
QoS Policy Applicability RxO Modifiable

DEADLINE T, DR, DW Y Y

The DEADLINE QoS policy defines the maximum inter-

Copyright PrismTech, 2017


arrival time between data samples
DataWriter indicates that the application commits to write a new
sample at least once every deadline period

DataReaders are notified when the DEADLINE is violated


Failure Detection
Source
DDS provides mechanism for detecting TD
traditional faults as well as

Copyright PrismTech, 2017


Sink t
performance failures

The Fault-Detection mechanism is Fault Notification


controlled by means of the DDS
Liveliness policy Source t
Performance Failures can be detected Sink
using the Deadline Policy which allows t
P P P
to receive notification when data is not
received within the expected delays
Performance Failure Notification
Transport Priority
The TRANSPORT_PRIORITY QoS policy is a hint to the

Copyright PrismTech, 2017


infrastructure as to how to set the priority of the underlying
transport used to send the data.

QoS Policy Applicability RxO Modifiable


TRANSPORT
T, DW N Y
PRIORITY
QoS Policy Applicability RxO Modifiable

TIME BASED FILTER DR N Y

Time-Based Filter
The Time Based Filter allows

Copyright PrismTech, 2017


to control the throughput at
which data is received by a
data reader

Samples produced more


often than the minimum
inter-arrival time are not
delivered to the data reader
QoS Modeling Idioms
System-Level QoS Policies
DURABILITY
LIVELINESS
HISTORY

Identify the QoS Policies that


OWENERSHIP
LIFESPAN
OWN. STRENGTH

capture the key non-functional

Copyright PrismTech, 2017


properties of the various kinds of
DEST. ORDER
DEADLINE
PARTITION
information flow in your system PRESENTATION Topic
LATENCY BUDGET

TRANSPORT PRIO
RELIABILITY

Define these QoS as Topics QoS TIME-BASED FILTER


USER DATA
RESOURCE LIMITS
TOPIC DATA
Create DataReaders and GROUP DATA

DataWriters but inheriting the


DW LIFECYCLE

DR LIFECYCLE
Topic QoS ENTITY FACTORY

RxO QoS Local QoS Not Applicable

Immutable
QoS Provider
Allo for deploy-time refinement of DDS QoS Policies

Copyright PrismTech, 2017


To allow for this leverage the QoS Provider

// QosProvider...
QosProvider qos_provider(
“file:///some/meaningful/path/qos.xml”,
“my-qos-profile");

DataReader<AType> dr(sub, topic, qos_provider.datareader_qos());


State vs. Events
DDS provides first class support for modelling distributed

Copyright PrismTech, 2017


state and events

Different QoS combination should be used to associate


with the topic representing a state or an event the
proper semantics
Soft State
In distributed systems you often need to model soft-state -- a
state that is periodically updated

Copyright PrismTech, 2017


Examples are the reading of a sensor (e.g. Temperature Sensor),
the position of a vehicle, etc.

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 that is sporadically updated and that often has temporal
persistence requirements

Copyright PrismTech, 2017


Examples are system configuration, a price estimate, etc.

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]
WriterDataLifecycle => autodispose_unregistered_instances = false
Event
In distributed systems you often need to model events -- the
occurrence of something noteworthy for our system

Copyright PrismTech, 2017


Examples are a collision alert, the temperature beyond a given
threshold, etc.

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
WriterDataLifecycle => autodispose_unregistered_instances = false
ResourceLimits => [define appropriate bounds]
Summing Up

Copyright PrismTech, 2017


Final Remarks
DDS provides a rich set of QoS

Copyright PrismTech, 2017


Policies to control the key DURABILITY
HISTORY
LIVELINESS
OWENERSHIP
DEST. ORDER

PARTITION
TIME-BASED FILTER

RESOURCE LIMITS

aspects of data distribution, LIFESPAN OWN. STRENGTH PRESENTATION

availability and resource


RELIABILITY DW LIFECYCLE

USER DATA DEADLINE DR LIFECYCLE

utilisation TOPIC DATA LATENCY BUDGET ENTITY FACTORY


GROUP DATA TRANSPORT PRIO

These QoS Policies are often Immutable RxO QoS Local QoS

applied in synergies to
implement key patters
Copyright PrismTech, 2017

Das könnte Ihnen auch gefallen