ss zg526-l3

Post on 17-Jan-2016

7 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

distributed computing

TRANSCRIPT

BITS Pilani Hyderabad Campus

SS ZG 526: Distributed Computing

Chittaranjan Hota, PhD

Dept. of Computer Sc. & Information Systems

hota@hyderabad.bits-pilani.ac.in

Second Semester 2014-2015

Lect 3: Communication models (Publish/Subscribe, Queuing

Models), Logical Clocks and Vector Clocks, Causal Order

What is Publish/Subscribe?

1/18/2015 2

Producer Consumer

Producer

Consumer

Topic 1 Topic 2

Topic 3

subscribe publish(topic, msg)

Publish subscribe

system

Message

Message

SS ZG526, Distributed Computing

Publish-and-subscribe messaging

1/18/2015 3

http://publib.boulder.ibm.com/infocenter/ledoc/v6r2/index.jsp?topic=/co

m.ibm.rcp.tools.doc.appdev/ovr10040.html

SS ZG526, Distributed Computing

Oracle IBM

http://docs.oracle.com/cd/E19587-01/821-0028/6nl41ccqd/index.html

Complex Publish/Subscribe Messaging - Oracle

1/18/2015 4

Source: http://docs.oracle.com/cd/E19587-01/821-0028/6nl41ccqd/index.html

SS ZG526, Distributed Computing

IBM MQ Series middleware

1/18/2015 5

• Runs on multiple platforms and enables applications to

send messages to other applications. The sending and

receiving applications do not have to be on the same

platform, and do not have to be executing at the same

time.

• MQSeries takes care of all the storage, logging and

communications details required to guarantee delivery of

the message to the destination queue. All the

applications have to do is know the name of the Queue

and agree on the meaning of the message.

SS ZG526, Distributed Computing

• Connect to a Queue Manager

• Open a queue

• Put or get messages

• Close a queue

• Disconnect

APIs: MQ Series

1/18/2015 6 SS ZG526, Distributed Computing

Local Queuing

1/18/2015 7 SS ZG526, Distributed Computing

Distributed Queuing

1/18/2015 8 SS ZG526, Distributed Computing

Inherent Limitations of a Distributed

System

• Absence of a global clock

– Unpredictable message transmission delays

– Drift from Physical time

• Absence of a shared memory

– Difficult to maintain coherent global state

• Solution: Logical Clocks

Inherent limitations of a Distributed System

1/18/2015 10

• Absence of a global clock

– Unpredictable message transmission delays

– Drift from Physical time

• Absence of a shared memory

– Difficult to maintain coherent global state

Solution: Logical Clocks

• Causality among events in a distributed system is a

powerful concept in reasoning, analysing, and drawing

inferences about a computation.

• The knowledge of the causal precedence relation among

the events of processes helps solve a variety of problems

in distributed systems, such as distributed algorithms

design, tracking of dependent events, knowledge about

the progress of a computation, and concurrency

measures.

Logical Clocks: Scalar time and Vector time

1/18/2015 11

Time-space diagram

1/18/2015 12

Space

Definition

• A system of logical clocks consists of a time domain T and a logical clock C. Elements of T form a partially ordered set over a relation <.

• Relation < is called the happened before or causal precedence. Intuitively, this relation is analogous to the earlier relation provided by the physical time.

• The logical clock C is a function that maps an event e in a distributed system to an element in the time domain T , denoted as C(e ) and called the timestamp of e , and is defined as follows:

C : H → T

such that the following property is satisfied:

for two events ei and ej,

A Framework for a System of Logical Clocks

1/18/2015 13 SS ZG526, Distributed Computing

• Proposed by Lamport in 1978 as an attempt to totally order

events in a distributed system.

• Time domain is the set of non-negative integers.

• The logical local clock of a process pi and its local view of

the global time are squashed into one integer variable Ci.

• Rules R1 and R2 to update the clocks are as follows:

• R1: Before executing an event (send, receive, or internal),

process pi executes the following:

Ci := Ci + d (d > 0)

In general, every time R1 is executed, d can have a

different value; however, typically d is kept at 1.

Scalar Time

1/18/2015 14 SS ZG526, Distributed Computing

• R2: Each message piggybacks the clock value of its

sender at sending time. When a process pi receives a

message with timestamp Cmsg , it executes the following

actions:

Ci := max(Ci , Cmsg )

Execute R1.

Deliver the message.

Scalar Time Continued…

1/18/2015 15 SS ZG526, Distributed Computing

Scalar Time Example

1/18/2015 16 SS ZG526, Distributed Computing

Consistency Property

• Scalar clocks satisfy the monotonicity and hence the

consistency property:

for two events ei and ej,

Total Ordering

• Scalar clocks can be used to totally order events in a distributed

system.

• The main problem in totally ordering events is that two or more

events at different processes may have identical timestamp.

• For example in Figure 3.1, the third event of process P1 and the

second event of process P2 have identical scalar timestamp.

Basic Properties

1/18/2015 17

A tie-breaking mechanism is needed to order such events. A

tie is broken as follows:

Process identifiers are linearly ordered and tie among events with

identical scalar timestamp is broken on the basis of their process

identifiers.

The lower the process identifier in the ranking, the higher the

priority.

The timestamp of an event is denoted by a tuple (t, i) where t is its

time of occurrence and i is the identity of the process where it

occurred.

The total order relation ≺ on two events x and y with timestamps

(h,i) and (k,j), respectively, is defined as follows:

Total Ordering

1/18/2015 18

Event counting

• If the increment value d is always 1, the scalar time has the

following interesting property: if event e has a timestamp h,

then h-1 represents the minimum logical duration, counted

in units of events, required before producing the event e;

• We call it the height of the event e.

• In other words, h-1 events have been produced

sequentially before the event e regardless of the processes

that produced these events.

Properties. . .

1/18/2015 19

No Strong Consistency

• The system of scalar clocks is not strongly consistent; that

is, for two events ei and ej,

• The reason that scalar clocks are not strongly consistent is

that the logical local clock and logical global clock of a

process are squashed into one, resulting in the loss causal

dependency information among events at different

processes.

Properties. . .

1/18/2015 20

top related