Publish/ Subscribe System s IBM? An Application Case UBS? UBS? - - PDF document

publish subscribe system s
SMART_READER_LITE
LIVE PREVIEW

Publish/ Subscribe System s IBM? An Application Case UBS? UBS? - - PDF document

ETH Zurich Kay Rmer Publish/ Subscribe System s IBM? An Application Case UBS? UBS? IBM: 100 : 20 UBS : 20 UBS Network 2 0 0 2 0 1 : S B : M U B I Characteristics Hard to realize with RPC S ender needs to know


slide-1
SLIDE 1

Publish/ Subscribe System s

Kay Römer ETH Zurich

slide-2
SLIDE 2

2

An Application Case

Network

IBM? UBS? UBS?

I B M : 1 U B S : 2 IBM: 100 UBS : 20 UBS : 20

slide-3
SLIDE 3

3

Characteristics

Hard to realize with RPC

– S ender needs to know identities of all receivers – S ender communicates with a large and dynamically changing set of receivers – S enders and receivers may not be up simultaneously – Information dissemination blocks sender

Many other applications

– S tock information systems, auction systems, air traffic control, news ticker, alerting services, ...

slide-4
SLIDE 4

4

Pub/ Sub Architecture

Publishers

– Entities that produce information

S

ubscribers

– Entities that consume information

Broker

– Delivers information from producers to consumers

Events

– Basic units of information

S

ubscription

– Expression of interest in certain events

publishers subscribers broker

events events events events events events subsc. subsc. subsc.

slide-5
SLIDE 5

5

Application Revisited

IBM? UBS? UBS?

I B M : 1 U B S : 2 IBM: 100 UBS : 20 UBS : 20

publishers subscribers broker events subscriptions

slide-6
SLIDE 6

6

Events & Notifications

Events

– Asynchronous state transitions – Have a type: „ stockvalue“ – May have parameters: „ IBM“ , „ 100“

  • Parameter names: „ company“ , „ value“
  • Parameter types: string, integer
  • S

pecial parameters: time, location

Representation

– Plain text, XML, binary encoding, ... – Example: stockvalue(string company=„ IBM“ , int value=100)

Notifications

– Messages carrying event representations

slide-7
SLIDE 7

7

Broker

Main tasks

– (De)registration of publishers / subscribers – Matching of events with subscriptions – Routing of events from publishers to matching subscribers

Different implementations

– Centralized vs. Distributed – S implicity vs. S calability

slide-8
SLIDE 8

8

Benefits

Decoupling of publishers and

subscribers

– S pace: no need to be connected or even know each other (anonymous) – Time: no need to be up at the same time – S ynchronization: publishing and receiving events are asynchronous operations

S

uitable for large, dynamic systems

– Many participating entities – Entities frequently enter and leave the system

slide-9
SLIDE 9

9

Event Matching

Key operation to identify subscribers to

which an event must be delivered

– Input: event e, set of subscriptions S – Output: all s ∈ Sthat match e

Depends on the semantics of subscriptions

– Type-based: type of the event – Channel-based: cf. multicast group – Topic-based: cf. news group – Content-based: parameters of events

slide-10
SLIDE 10

10

Type-Based Subscriptions

S

ubscriptions specify the type of the requested events

– E.g., „ stockvalue“

Event matching

– Comparison of event type and suscription type

slide-11
SLIDE 11

11

Channel-based Subscriptions

Multiple, named broadcasts channels can be

created

– E.g., news, stock, ...

Publishers publish events to a specific

channel

– Events of different types may be published to a single channel

S

ubscriptions specify the desired channel

Event matching

– E.g., a multicast group for each channel

news stock

slide-12
SLIDE 12

12

Topic-Based Subscriptions

Each event has a „ topic“ parameter Topics are organized in a hierarchy S

ubscriptions specify a topic of interest

Event matching:

– s matches e if topic of e is descendent of topic of s in the hierarchy

stock IT financial banks insurance IBM UBS CS

slide-13
SLIDE 13

13

Content-Based Subscriptions

S

ubscriptions refer to type and parameters values of events

– E.g., type=„ stockvalue“ ∧ company=„ UBS “

∧ value < 100

– Often a conj unction over atomic predicates: (p1 op1 v1) ∧ (p2 op2 v2) ∧ ...

Event matching

– s matches e if the predicate of s holds on the parameter values of e – Algorithms to process multiple subscriptions with much lower overhead

  • If „ value < 100“ doesn‘ t match, then „ value < 20“ won‘ t

match as well

slide-14
SLIDE 14

14

Event Routing

Nontrivial problem with distributed

brokers for content-based subscriptions

– Cannot use address-based routing!

Many different approaches

– Hierarchical vs. peer-to-peer – Flooding vs. overlay

slide-15
SLIDE 15

15

A Distributed Broker Model

S

ubscribers and publishers connect to a local broker

Brokers maintain connections to some, but

not all other brokers

– Form connected (acyclic? ) network

Routing problem:

– Broker receives an event from either a publisher

  • r another broker

– To which brokers (and subscribers) should the event be sent?

slide-16
SLIDE 16

16

Event Flooding

If a broker receives an event e from n

– Do nothing if e has been received before – S end e to all neighboring brokers except n – S end e to all matching subscribers

Ensures that all brokers will receive

each event

slide-17
SLIDE 17

17

Exam ple

Event: e(v=...) Content-based subscription: v<100

1 2 4 3 5

v<100 e(v=2)

slide-18
SLIDE 18

18

Subscription Flooding

Idea: Use subscriptions to compute routing paths for

events

– This causes overhead whenever a subscriptions is added / removed / changed – But pays off if subscriptions change rarely compared to number of events published

Approach: each broker maintains a routing table of

entries (ni, si)

– n = neighboring broker, s = subscription – S end e to all ni where si matches e

S

etup by subscription flooding: When a broker receives s from n

– Do nothing if s has been received before – Create routing table entry (n, s) – S end s to all neighboring brokers

slide-19
SLIDE 19

19

Exam ple

Event: e(v=...) Content-based subscription: v<100

1 2 4 3 5

v<100 5: v<100 2: v<100 2: v<100 4: v<100

6

e(v=2)

slide-20
SLIDE 20

20

Covered Subscriptions

Observations

– Flooding the complete network for each subscription – Each broker has one routing table entry per subscription

Idea: exploit redundancy of subscriptions

– E.g., events matching „ v<20“ also match „ v<100“ – We say: „ v<100“ covers „ v<20“

Modified route setup: When a broker receives s

from n

– Do nothing if s has been received before – Do nothing if there is an entry (n, si) and s is

covered si

– Create routing table entry (n, s) – S end s to all neighboring brokers

slide-21
SLIDE 21

21

Exam ple

1 2 4 3 5

v<100 5: v<100 2: v<100 2: v<100 4: v<100

7

e(v=2)

6

v<20 6: v<20 4: v<20 Beware

  • f loops

How to handle Unsubscriptions?

slide-22
SLIDE 22

22

Subscription Merging

Goal: reduce size of the routing table Approach: Merge two routing table

entries with same destination into one

– Perfect: (1, v<10), (1, v>10) -> (1, v≠10) – Imperfect: (1, v<10), (1, v>11) -> (1, v≠10)

slide-23
SLIDE 23

23

Advertisem ents

Idea: Publishers announce details on the

events they will generate, e.g. v<500

– Assuming this won‘ t change over time

Approach: Flood advertisements, building a

second routing table

– S ubscriptions are no longer flooded, but routed using the advertisement routing table – Instead of checking if an event matches a subscription, need to check if a subscription

  • verlaps an advertisement
  • E.g., v<500 and v<100 overlap, but not v<500 and v >

600

slide-24
SLIDE 24

24

Exam ple

Advertisement: v<500 S

ubscription: v<100

1 2 4 3 5

v<100 1: v<500 3: v<500 6: v<500 1: v<500

6

v<500 What if advertisement after subscription? What if almost concurrently? 5: v<100 2: v<100

slide-25
SLIDE 25

25

Further I ssues

Dynamic networks

– Joining, leaving, crashing brokers

Intermittent connectivity

– Mobile networks with roaming publishers / subscribers – Event buffering

Quality of S

ervice

– Event ordering, latency, guaranteed delivery, security, ...

Composite events

– A and B, A followed by B, ...