+ All Categories
Home > Technology > Vortex Tutorial -- Part I

Vortex Tutorial -- Part I

Date post: 01-Dec-2014
Category:
Upload: angelo-corsaro
View: 503 times
Download: 0 times
Share this document with a friend
Description:
This presentation introduced Vortex by means of a running example. Throughout the presentation we will show how Vortex makes it easy to build a micro-blogging platform a la Twitter.
55
Angelo Corsaro, PhD Chief Technology Officer [email protected] Vortex Tutorial Part I
Transcript
Page 1: Vortex Tutorial -- Part I

Angelo  Corsaro,  PhD  Chief  Technology  Officer  

[email protected]

Vortex Tutorial Part I

Page 4: Vortex Tutorial -- Part I

Security Model

Page 5: Vortex Tutorial -- Part I

Cop

yrig

ht P

rism

Tech

, 201

4

Support for transport level security via TLS and DTLS

Support for fine grained access control

Access control plug-in compliant with DDS Security

Vortex Security Model

Arthur Dent

Arthur Dent

Ford Prerfect

Zaphod Beeblebrox

Marvin

Trillian

A(r,w), B(r)

A(r,w), B(r,w), X(r)

*(r,w)

*(r)

A(r,w), B(r,w), C(r,w)

Ford Prerfect

Zaphod Beeblebrox

Trillian

Marvin

A

B

A,BX

*

*

A,B,C

Identity Access RightsSessions are authenticated and communication is encrypted

Only the Topic included as part of the access rights are visible and accessible

Page 6: Vortex Tutorial -- Part I

Use Cases

Page 11: Vortex Tutorial -- Part I

Building ChirpIt

Page 12: Vortex Tutorial -- Part I

Cop

yrig

ht P

rism

Tech

, 201

4

To explore the various features provided by the Vortex platform we will be designing and implementing a micro-blogging platform called ChirpIt. Specifically, we want to support the following features:

ChirpIt users should be able to “chirp”, “re-chirp”, “like” and “dislike” trills as well as get detailed statistics

The ChirpIt platform should provide information on trending topics — identified by hashtags — as well as trending users

Third party services should be able to flexibly access slices of produced trills to perform their own trend analysis

ChirpIt should scale to millions of users

ChirpIt should be based on a Lambda Architecture

ChirpIt Requirements

Page 14: Vortex Tutorial -- Part I

The Data Distribution Service

Page 20: Vortex Tutorial -- Part I

Decomposing DDS

Page 21: Vortex Tutorial -- Part I

Information Organisation

Page 24: Vortex Tutorial -- Part I

Information Definition

Page 26: Vortex Tutorial -- Part I

Cop

yrig

ht P

rism

Tech

, 201

4

As explained in the previous slide a topic defines a class/type of information

Topics can be defined as Singleton or can have multiple Instances

Topic Instances are identified by means of the topic key

A Topic Key is identified by a tuple of attributes -- like in databases

Remarks: - A Singleton topic has a single domain-wide instance - A “regular” Topic can have as many instances as the number of different key

values, e.g., if the key is an 8-bit character then the topic can have 256 different instances

Topic and Instances

Page 27: Vortex Tutorial -- Part I

ChirpIt Data Model

Page 28: Vortex Tutorial -- Part I

Cop

yrig

ht P

rism

Tech

, 201

4

Chirp Actions      union  ChirpBody  switch  (ChirpActionKind)  {          case  CHIRP_KIND:              string<128>  chirp;          case  RECHIRP_KIND:              string<128>  chirp;              string  user;          case  LIKE_KIND:              string  luser;          case  DISLIKE_KIND:              string  duser;          };  !                  struct  ChirpAction  {              ChirpHeader  header;              ChirpBody      body;          };          #pragma  keylist  ChirpAction  header.id.cid    

     struct  ChirpId  {              string  uid;              string  cid;          };  !        enum  ChirpActionKind  {              CHIRP_KIND,  RECHIRP_KIND,                LIKE_KIND,  DISLIKE_KIND          };                    struct  ChirpHeader  {              ChirpId  id;              Location  location;              unsigned  long  long  timestamp;              ChirpActionKind  kind;          };            

Page 29: Vortex Tutorial -- Part I

Cop

yrig

ht P

rism

Tech

, 201

4

ChirpIt Statistics

       struct  ChirpStats  {              ChirpId  id;              unsigned  long  rechirps;              unsigned  long  likes;          };          #pragma  keylist  ChirpStats  id.cid  

       struct  UserStats  {              string  userId;              unsigned  long  followers;              unsigned  long  chirps;              unsigned  long  followed;          };          #pragma  keylist  UserStats  userId  

Page 32: Vortex Tutorial -- Part I

ChirpIt Information Scoping

Page 36: Vortex Tutorial -- Part I

Cop

yrig

ht P

rism

Tech

, 201

4

In summary partitions are used to scope information

Each user will “join” a partition for each followed party

Example:

- If @drx follows @magneto, @wolverine, @cyclops and @mistique then he will receive ChirpActions from the partitions:

• chirp:@magneto, chirp:@wolverine, chirp:@cyclops and chirp:@mistique

- On the other hand, regardless of the people that follows @wolverine he will always and only write ChirpActions in the partitions

• chirp:@wolverine

Using Partitions to Scope Chirps

Page 37: Vortex Tutorial -- Part I

Producing Information

Page 40: Vortex Tutorial -- Part I

Consuming Information

Page 42: Vortex Tutorial -- Part I

Putting all Together

Page 43: Vortex Tutorial -- Part I

Cop

yrig

ht P

rism

Tech

, 201

4

DomainParticipant: Provides access to a data cloud -- called a domain in DDS

Topic: Domain-wide definition of a kind of Information

Publisher/Subscriber: Provide scope to data sharing through the concept of partitions DataReader/DataWriter: Allow to read/write data for a given topic in the partitions their Subscriber/Publisher are associated with.

DDS EntitiesDomain (e.g. Domain 123)

Domain Participant

Topic

Publisher

DataWrter

Subscriber

DataReader

Partition (e.g. “Telemetry”, “Shapes”, )

Topic Instances/Samples

TaTb

Tc

Tx

Ty

T1

T1 T3

Page 44: Vortex Tutorial -- Part I

ChirpIt Implementation — Chirping —

Page 45: Vortex Tutorial -- Part I

Cop

yrig

ht P

rism

Tech

, 201

4

ChirpOut App            //  Domain  Participant  defined  by  dependency  injection                            //  Define  the  topic              val  topic  =  Topic[ChirpAction](Config.ChirpActionTopic)              //  Define  the  publisher  and  link-­‐it  up  to  the  “chirp:@user”  partition              val  pubQos  =  PublisherQos()                        .withPolicy(Partition(Config.ChirpRootPartition  +  user))              implicit  val  pub  =  Publisher(pubQos)              //  Define  the  data  writer  and  make  it  reliable  and  for  the  time  being              //  Transient  Local…  Will  refined  this  in  the  Part  II              val  dwQos  =  DataWriterQos().withPolicies(                  Reliability.Reliable,                  Durability.TransientLocal)              //  Create  the  DataWriter              val  dw  =  DataWriter[ChirpAction](pub,  topic,  dwQos)              //  Chirp!!!              val  chirp  =  …              dw.write(chirp)

Page 46: Vortex Tutorial -- Part I

Cop

yrig

ht P

rism

Tech

, 201

4

ChirpIn            //  Domain  Participant  defined  by  dependency  injection                            //  Define  the  topic              val  topic  =  Topic[ChirpAction](Config.ChirpActionTopic)              //  Define  the  subscribe  and  link-­‐it  up  to  the  partition  associated  to              //  the  user  followed              val  subQos  =  PublisherQos()                        .withPolicy(Partition(followerList.map(Config.ChirpRootPartition  +  _))              implicit  val  sub  =  Subscriber(subQos)              //  Define  the  data  reader  and  make  it  reliable  and  for  the  time  being              //  Transient  Local…  Will  refined  this  in  the  Part  II              val  drQos  =  DataReaderQos().withPolicies(                  Reliability.Reliable,                  Durability.TransientLocal)              //  Create  the  DataWriter              val  dr  =  DataReader[ChirpAction](sub,  topic,  drQos)  

Page 47: Vortex Tutorial -- Part I

Cop

yrig

ht P

rism

Tech

, 201

4

ChirpIn

//  React  to  new  Chirp  dr  listen  {        case  DataAvailable(_)  =>  {                      //  take  vs.  read  will  become  clear  in  Part  II                      val  samples  =  dr.take()                    //  For  the  time  being  simply  print-­‐out  the  new  chirps                      samples         .filter(s  =>  (s.getData  !=  null))                        .foreach(s  =>  displayChirp)                  }    }

Page 48: Vortex Tutorial -- Part I

Cop

yrig

ht P

rism

Tech

, 201

4

ChirpOut App// Define the topic — assuming the topic is registered with the server…!topic = new dds.Topic(0, 'Chirp', ‘com.ChirpIt’)!// Define the data writer Qos!dwQos = new dds.DataWriterQos(! dds.Reliability.Reliable, ! dds.Durability.TranslientLocal,! dds.Partition(userPartition))!!// Use an Option monad to maintain the writer!chirpWriter = z_.None!!// Create the writer when the runtime is connected!runtime.onconnect(() ->! dw = new dds.DataWriter(runtime, topic, dwQos)! chirpWriter = z_.Some(dw)!)!!// …!// Write chirps!chirp = …!chirpWriter.map((dw) -> dw.write(chirp))!

Page 49: Vortex Tutorial -- Part I

Cop

yrig

ht P

rism

Tech

, 201

4

ChirpIn App// Define the topic — assuming the topic is registered with the server…!topic = new dds.Topic(0, 'Chirp', ‘com.ChirpIt’)!// Define the data reader Qos!drQos = new dds.DataWriterQos(! dds.Reliability.Reliable, ! dds.Durability.TranslientLocal,! dds.Partition(followedList))!!// Use an Option monad to maintain the reader!chirpReader = z_.None!!// Create the writer when the runtime is connected!runtime.onconnect(() ->! dr = new dds.DataReader(runtime, topic, dwQos)! // Attach a listener! dr.addListener((chirp) -> diplayChirp(chirp))! chirpReader = z_.Some(dr)!)

Page 51: Vortex Tutorial -- Part I

Live Demo

Page 52: Vortex Tutorial -- Part I

Cop

yrig

ht P

rism

Tech

, 201

4

$ ./chirpOut @wolverin chirp>> @magneto will win!$ ./chirpOut @magneto

@magneto>> @wolverine chirping while asleep… again!

Download the package zip or tar.gz package available at:

- https://dl.dropboxusercontent.com/u/19238968/webcast/2014/10/chirpit.zip

- https://dl.dropboxusercontent.com/u/19238968/webcast/2014/10/chirpit.tar.gz

Extract the package somewhere in your file-system and open a terminal at that location and run the app as shown below

ChirpIt Demo

$ ./chirpIn @magneto @wolverinse @mystique @wolverin>> @magneto will win! @magneto>> @wolverine chirping while asleep… again!

Page 54: Vortex Tutorial -- Part I

Cop

yrig

ht P

rism

Tech

, 201

4

In this presentation we have performed the first step toward implementing a micro-blogging platform

The combination of Vortex Device and Vortex Cloud made it very easy to create and deploy our Internet-Scale, multi-device micro-blogging platform

Some of the DDS QoS, such as Durability have already shown how historical data, i.e. chirps made while we were offline — can be provided by the platform

The Part II will illustrate how the complete application fits together and what is the role of Vortex in the Lambda Architecture

Summary


Recommended