Docsity

Publish/Subscribe Systems: IBM, Microsoft, and Oracle, Slides of Introduction to Database Management Systems

Toggle sidebar
bg1
1
Publish/Subscribe Systems
CPS 116
Introduction to Database Systems
2
Announcements
Midterm this Thursday (October 7) in class
Open-book, open-notes
Materials up to and including last Thursday’s lecture
Sample solution to sample midterm (handed out last
week) available today
Supplemental Problem Set #1 posted last Saturday
Sample solution available today
3
Publish/subscribe systems
Michael Caldwell
Introduction to publish/subscribe
IBM Gryphon project
Ayonike Akingbade
Oracle’s expression data
James Galdos
Microsoft SQL server notification service
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Publish/Subscribe Systems: IBM, Microsoft, and Oracle and more Slides Introduction to Database Management Systems in PDF only on Docsity!

Publish/Subscribe Systems

CPS 116

Introduction to Database Systems

2

Announcements

™ Midterm this Thursday (October 7) in class

ƒ Open-book, open-notes

ƒ Materials up to and including last Thursday’s lecture

ƒ Sample solution to sample midterm (handed out last

week) available today

™ Supplemental Problem Set #1 posted last Saturday

ƒ Sample solution available today

3

Publish/subscribe systems

™ Michael Caldwell

ƒ Introduction to publish/subscribe

ƒ IBM Gryphon project

™ Ayonike Akingbade

ƒ Oracle’s expression data

™ James Galdos

ƒ Microsoft SQL server notification service

Publish/Subscribe

An Introduction to IBM’s, Microsoft’s and Oracle’s solutions to a growing demand for interconnecting information providers and subscribers in a distributed system

10-05-

What is Publish Subscribe?

„ Information Producers (Publishers)
„ Information Consumers (Subscribers)
„ Events/Messages
„ Many-to-many
„ Publishers and Subscribers are
anonymous (need not be aware of each
other)

Group-Based Pub/Sub

„ Producers publish messages with a pre- defined subject or group. e.g., cs department activity announcements „ System delivers messages to all consumers subscribing to pre-defined subject, or group members „ Easily implemented via tables which match subject categories to consumers, but… „ Not very flexible and each subscriber must do its own filtering

Content-Based Pub/Sub

„ Messages are routed on basis of content , not category. e.g., activity announcements where activity.date < today+7 and location = ‘LSRC’ „ A different kind of paradigm, each subscription is equivalent to a predicate which tests an event’s attributes. „ Much more flexible than group-based pub/sub, but scalability and reliability become much more difficult

  • Can easily implement a group-based publish subscribe system within the framework of content-based

Content Based Pub/Sub vs.

Traditional DB Design

„ Content-based pub/sub presents a
challenge to the existing DB paradigm:
  • Database: „ Data is stored „ Queries arrive and must be checked against data
  • Pub/Sub (“Inverse” of Database): „ Queries are stored „ Data arrives and must be checked against queries

Why Do People Need Content

Based Pub/Sub Systems?

„ Real Time Data Reporting:

  • stock trading, sports scores, breaking
news, etc.
  • INET Book Viewer

„ Message Oriented Middleware:

  • “glues” together many different
applications between multiple
businesses or within a single firm
(mergers).

Exactly Once Delivery (cont’d)

„ Streams: represents
information for each time tick, t
  • Knowledge (K[t]) - downstream „ Q: lack of knowledge „ D: published at t „ D*: every downstream subscriber has delivered D „ S: silence „ F: final (don’t care) „ E: error
  • Curiosity (C[t]) - upstream „ C: curious „ A: anti-curious/ack „ N: neutral

Exactly-Once: Terminology

„ A gap is a sequence of Q ticks between non-q ticks
in a stream.
„ Checkpoint Token: each subscriber maintains set
of (pubend, timestamp) pairs which describes
when they connected to each pub end
„ A subscriber is in catch-up mode if it is still
consuming events that it missed during disconnect
„ The doubt horizon is the latest timestamp such
that all ticks between latestDelivered and the
timestamp are not ‘Q’ (unknown)
S S Q Q Q D D

Terminology

„ Pubend: publisher hosting broker

(phb)

  • only stream which stably stores
information

„ Subend: subscriber hosting broker

(shb)

Knowledge Graph inside SHB

„ SHB = S ubscriber H osting B roker „ Event Retention/Release Protocol:

  • The data of any D ticks after the Doubt Horizon is not delivered until all Q ticks have been resolved

Publish / Subscribe

with Oracle Expressions

Outline

„ Publish / Subscribe using Oracle

„ Expressions

„ Evaluate Operator

„ Indexing

„ Publishing Example

Oracle Publish / Subscribe

„ Oracle provides a way for users to filter the
information they would like to receive
„ Allows a subscription service to send information
to only users who have requested it
„ Uses Expression filters to decide which users
should receive the information
„ Can filter information not just on type of
information but the value of the information
Example: Rather than get information on all
basketball teams, get scores on teams
with winning records

Expressions

„ Boolean conditions

„ Evaluates to true if incoming data meets a

user’s interests

„ Must follow the SQL-WHERE clause

format

„ Can reference any table, column, or

function in a database (called data items)

Examples of Expressions

„ Model, Price, Mileage, Year and Color are all columns in a Car Table „ EX1: Model = ‘Taurus’ and Price < 15000 and Mileage < 2500 „ EX2: Model = ‘Mustang’ and Year > 1999 and Price < 20000 „ Ex3: Price < 15000 and Color = ‘Red’

„ Can also include functions „ Horsepower(Model, Year) gives the horsepower for a car with the given model and year „ EX4: Horsepower(Model, Year) > 200 and Price < 25000

How to Set Up Expressions

„ Expressions are stored in a column of an
expression table
„ They are stored as varchar2 variables
„ An expression table may include other columns
such as ID of user and other demographics
„ Each row will include one expression for one
user

Index Processing

„ When given values for the data items, the
predicates for the most commonly referenced
data items are first computed.
„ The Sparse Predicates are then computed for
the expressions where the above predicates all
evaluate to true
„ If the sparse predicates are also true for a given
expression then that means the whole
expression is true

Using Expressions for Publish / Subscribe

„ Expressions in Oracle only provide a way to filter
what users receive what information
„ Does not deal with how to publish the
information to users
„ The application is responsible for handling the
content based subscriptions and writing
expressions to fit the subscription criteria

Publishing

„ We can use Triggers that will check every time new data comes in if it meets a user’s interest. We can then notify such users or publish the information to them. „ EX: CREATE TRIGGER activechk AFTER insert OR update ON Car FOR EACH ROW DECLARE cursor c1 (ditem VARCHAR2) is SELECT c.cid, FROM Consumer c WHERE EVALUATE (c.Interest, ditem) = 1; ditem VARCHAR2(200); BEGIN ditem := Car.getVarchar ( :new.Model, :new.Year :new.Price, :new.Mileage); for cur in c1(ditem) loop notify(CID); // notify users end loop; END

Summary

„ Oracle uses Expressions to filter

information sent to users and provide

content-based subscriptions

„ Expressions can be indexed to allow for

quick evaluation

„ Oracle does not have a built in notification

or publishing service

Microsoft Notification Services

What Microsoft Did

  • “Providing an easy-to-use development model that takes advantage of XML, SQL, and the Microsoft .NET common language runtime, enabling enterprises to quickly build scalable notification applications.”

Microsoft Targets

Who Can Use Microsoft Notification Services?

Consumer Applications: stock info, financial institution send account balances and overdraft notifications, airline flight arrivals

Operational Applications: Machine is down, manager notified

Business Intelligence: inventory low, send more

Employee Communication: when files updated, when new reports are available

“Easy to Use”

Developers build an Application Definition File that contains central logic for sending notifications

  • You need to know XML, SQL, XSLT (Extensible Stylesheet Language Transformations)

Integrated with Visual Studio .NET – don’t need to learn new tools

Although the tools are familiar, you will see the Application Developer bears a great burden for making MSNS powerful

Create the Application Definition File

(ADF)

In this file the developer defines:

  • Structure of the data
  • Queries used to process data
  • How notifications are processed and delivered
  • Operational parameters for your application

All Events and Event Providers your application deals with must be specified

All of the rules that a subscription can follow: Can a User compare new events with past notifications? Can you show the highest stock price of the past day?

MSNS is very powerful but is heavily dependent on the developer

Basic Flow: Collecting Events

Collecting Events:

  1. Events happen in the world
  2. The Application Developer specifies Event Providers , which give collect batches of events and give them to the application’s Event Table
  3. These batches of events in the Event Table are then compared to subscriptions – what people have asked for.

EC = E-EH

Events Chronicle (EC) ArticleId Headline

Events ArticleId 123 152

EventId Headline Microsoft SQL Server Notification Services passes the $500M mark in Q3 sales 124 76 Microsoft Xbox Live network to open in Europe on March ‘ 125 598 Microsoft SQL Notification Services adopted by AOL internal groups.

Events History ArticleId Headline

Events Chronicle Rule

Events History (EH) ArticleId 152

Headline Microsoft SQL Server Notification Services passes the $500M mark in Q3 sales 76 Microsoft Xbox Live network to open in Europe on March ‘ 598 Microsoft SQL Notification Services adopted by AOL internal groups.

GR: updates the EH with new events

152 Microsoft SQL Server Notification Services passes the $500M mark in Q3 sales 76 Microsoft Xbox Live network to open in Europe on March ‘ 598 Microsoft SQL Notification Services adopted by AOL internal groups.

First pass: events arrive in the system

ECR: adds new articles to EC

Events History (EH) ArticleId 152

Headline Microsoft SQL Server Notification Services passes the $500M mark in Q3 sales 76 Microsoft Xbox Live network to open in Europe on March ‘ 598 Microsoft SQL Notification Services adopted by AOL internal groups.

Events

ArticleID: Headline: (^152) Microsoft SQL Server Notification Services passes the $500M mark in Q3 sales ArticleID: Headline: (^65) Windows .NET Server and Yukon Beta1 get top spot on TPC benchmark ArticleID: Headline: (^178) Microsoft announces add-on pack for Microsoft SQL Server Notification Services

Events Chronicle Rule

Events History (EH) ArticleId 152

Headline Microsoft SQL Server Notification Services passes the $500M mark in Q3 sales 76 Microsoft Xbox Live network to open in Europe on March ‘ 598 Microsoft SQL Notification Services adopted by AOL internal groups. 65 Windows .NET Server and Yukon Beta1 get top spot on TPC benchmark 178 Microsoft announces add-on pack for Microsoft SQL Server Notification Services

ECR adds new articles to EC

GR: updates the EH with new events

Second pass: new batch with duplicate article

65 Windows .NET Server and Yukon Beta1 get top spot on TPC benchmark 178 Microsoft announces add-on pack for Microsoft SQL Server Notification Services

152 Microsoft SQL Server Notification Services passes the $500M mark in Q3 sales

Events Chronicle (EC) ArticleId Headline 76 Microsoft Xbox Live network to open in Europe on March ‘ 598 Microsoft SQL Notification Services adopted by AOL internal groups.

EC Table

Implementing History

We now have a history of all the EVENTS.
But MSNS provides more:
History of Subscribers, Subscriptions, and Notifications

Implementing History

™ Per subscription class
™ Keep subscription-specific information

™ Example: Notify me only if the stock value is higher than the last time I was notified (for that stock) ™ Example: ExpirationDate per subscription

™ Per notification class

™ Example: recent alerts

Subscriber
History
Notification
History
Subscription
History
™ Per subscriber
™ Across all subscription classes

™ Example: Send an SMS if number of allowed SMS has not been exceeded

ANDS/ORS

Dealing with ANDs and Ors : The User could specify tons of predicates “Alert me with This AND That AND Those OR the Other Thing”

You want to handle an arbitrary number of predicates and use the power of set oriented operations (this is what SQL does)

So you break down each predicate into its own subscription row

HUGE Optimization and flexibility by having each subscription take up many rows in the subscriptions table

Events Param 246 Sugar

LabOrderID

246 Cholesterol

Value

Low 0 0

High 50 25 246 Iron 55 0 50

PredicateCount = 3

Predicates

  • Break down user subscription into predicates: 1 predicate = 1 subscription row

Alert me if Sugar level is out of range AND Cholesterol level is out of range AND Iron level is out of range AND ...

Predicate 1 Predicate 2 Predicate 3

Subscriptions

LabOrderId

246

SubscriberId

patricet

Param

Sugar patricet 246 Cholesterol patricet 246 Iron

Predicate Count 3 3 3

Sugar, Cholesterol and Iron are out of range!

Out of Range?

PredicateCountMatch = 3

  • Generate a notification if all predicates are true (PCM=PC)

Summary

Microsoft has provided numerous features and the ability to create notifications on extremely complex criteria.

MSNS is very scalable but they do not provide much for notification delivery.

MSNS puts power with the developer. The Application Developer must develop all the matching rules, history rules, even provider logic, data organization, and notification formatting.

Requires application developer skilled with all aspects of process: XML, SQL, Microsoft Visual Studio .NET, XSLT and preferably delivery methods.