Message Ordering and Group Communications Course: Distributed - - PowerPoint PPT Presentation

message ordering and group communications
SMART_READER_LITE
LIVE PREVIEW

Message Ordering and Group Communications Course: Distributed - - PowerPoint PPT Presentation

Message Ordering and Group Communications Course: Distributed Computing Faculty: Dr. Rajendra Prasath Spring 2019 About this topic This course covers various concepts in Message Ordering and Group communication in Distributed Systems. We will


slide-1
SLIDE 1

Message Ordering and Group Communications

Course: Distributed Computing Faculty: Dr. Rajendra Prasath

Spring 2019

slide-2
SLIDE 2

About this topic

This course covers various concepts in Message Ordering and Group communication in Distributed

  • Systems. We will also focus on different models of

communications and their pros and cons

2

Rajendra, IIIT Sri City

slide-3
SLIDE 3

What did you learn so far? What did you learn so far?

è Challenges in Message Passing systems è Distributed Sorting è Space-Time Diagram è Partial Ordering / Total Ordering è Causal Ordering - Precedence Relations è Concurrent Events è Local Clocks and Vector Clocks è Distributed Snapshots è Termination Detection using Dist. Snapshots è Leader Election Problem in Rings

RECAP

Rajendra, IIIT Sri City

3

slide-4
SLIDE 4

Recent Recent Topic

  • pic …

è Topology Abstraction and Overlays

è Various Interconnection Topologies è Abstraction - Basic Concepts è Interconnection Patterns suitable for message propagation è Types of Algorithms and their executions è Measures and Metrics

è Many more to come up … stay tuned in !!

Rajendra, IIIT Sri City

4

slide-5
SLIDE 5

Topics to focus on

  • pics to focus on …

è Leader Election in Distributed Systems è Topology Abstraction and Overlays

è Message Ordering è Group Communication

è Distributed Mutual Exclusion è Deadlock Detection è Check pointing and rollback recovery

For Mid Semester 2

Rajendra, IIIT Sri City

5

slide-6
SLIDE 6

Message Ordering / Group Communication

Rajendra, IIIT Sri City

6

slide-7
SLIDE 7

Models of Models of Communication Communication

è One – to – One

è Unicast

è 1 – 1 è Point – to – point

è Anycast

è 1 – nearest 1 of several identical nodes

è One – to – Many

è Multicast

è 1 – many è Group Communication

è Broadcast

è 1 – All

7

Rajendra, IIIT Sri City

slide-8
SLIDE 8

Gr Groups

  • ups

è Why groups?

è Groups allow us to deal with a collection of processes as one abstraction

è Send message to one entity

è Deliver to entire group

è Groups are dynamic

è Created and destroyed è Processes can join or leave

è May belong to 0 or more groups

è Primitives

è join_group, leave_group, send_to_group, query_membership

8

Rajendra, IIIT Sri City

slide-9
SLIDE 9

Design Issues Design Issues

Closed vs. Open

è Closed: only group members can sent messages

Peer vs. Hierarchical

è Peer: each member communicates with group è Hierarchical: go through dedicated coordinator(s) è Diffusion: send to other servers & clients

Managing membership & group creation/deletion

è Distributed vs. centralized

Leaving & joining must be synchronous Fault tolerance

è Reliable message delivery? What about missing members?

9

Rajendra, IIIT Sri City

slide-10
SLIDE 10

Failur ailures es

è Crash failure

è Process stops communicating

è Omission failure (typically due to network)

è Send omission: A process fails to send messages è Receive omission: A process fails to receive messages

è Byzantine Failure

è Some messages are faulty, including sending fake messages

è Partition Failure

è The network may get segmented, dividing the group into two or more unreachable sub-groups

10

Rajendra, IIIT Sri City

slide-11
SLIDE 11

Multiple Unicasts Multiple Unicasts

è Sender knows Group members

11

Rajendra, IIIT Sri City

slide-12
SLIDE 12

Hier Hierar archical chical

è Multiple unicasts via group coordinator

è coordinator knows group members 12

Rajendra, IIIT Sri City

slide-13
SLIDE 13

Atomic Multicast Atomic Multicast

è Atomicity

è Message sent to a group arrives at all group members

è If it fails to arrive at any member, no member will process it

è Problems

è Unreliable network

è Each message should be acknowledged è Acknowledgements can be lost è Message sender might die

13

Rajendra, IIIT Sri City

slide-14
SLIDE 14

How to achieve How to achieve Atomicity? Atomicity?

è General Idea

è Ensure that every recipient acknowledges receipt of the message è Only then allow the application to process the message è If we give up on a recipient then no recipient can process the received message

è Easier said than done!

è What if a recipient dies after acknowledging the message?

è Is it obligated to restart? è If it restarts, will it know to process the message?

è What if the sender (or coordinator) dies partway through the protocol?

14

Rajendra, IIIT Sri City

slide-15
SLIDE 15

Achieving Achieving Atomicity Atomicity – An Example An Example

Retry through network failures & system downtime

è Sender & receivers maintain a persistent log è Each message has a unique ID so we can discard duplicates è Sender – sends the message to all group members – Writes the message to log – Waits for acknowledgement from each group member – Writes the acknowledgement to log – If timeout on waiting for an acknowledgement, retransmit to group member è Receiver logs received non-duplicate message to persistent log and sends an acknowledgement NEVER GIVE UP! – Assume that dead senders or receivers will be rebooted and will restart where they left off

15

Rajendra, IIIT Sri City

slide-16
SLIDE 16

Reliable multicast Reliable multicast

All non-faulty group members will receive the message

Ø Assume sender & recipients will remain alive Ø Network may have glitches

  • Retransmit undelivered messages

Acknowledgements

Ø Send message to each group member Ø Wait for acknowledgement from each group member Ø Retransmit to non-responding members Ø Subject to feedback implosion

Negative acknowledgements

Ø Use a sequence number on each message Ø Receiver requests retransmission of a missed message Ø More efficient but requires sender to buffer messages indefinitely

16

Rajendra, IIIT Sri City

slide-17
SLIDE 17

Acknowledgements Acknowledgements

Easiest thing is to wait for an ACK before sending the next message – But that incurs a round-trip delay Optimizing – Pipelining § Send multiple messages – receive ACKs asynchronously § Set timeout – retransmit message for missing ACKs – Cumulative ACKs § Wait a little while before sending an ACK § If you receive others, then send one ACK for everything – Piggybacked ACKs § Send an ACK along with a return message TCP does all of these … but now we have to do this on each recipient

17

Rajendra, IIIT Sri City

slide-18
SLIDE 18

Message Or Message Ordering dering

How to order messages?

Send vs Delivery Global Time Ordering Total Ordering Causal Ordering Sync Ordering FIFO Ordering Unordered multicast

Good / Bad Ordering

18

Rajendra, IIIT Sri City

slide-19
SLIDE 19

Good Or Good Ordering dering

An Example 19

Rajendra, IIIT Sri City

slide-20
SLIDE 20

Bad Or Bad Ordering dering

An Example 20

Rajendra, IIIT Sri City

slide-21
SLIDE 21

Good Or Good Ordering dering

Another Example 21

Rajendra, IIIT Sri City

slide-22
SLIDE 22

Bad Or Bad Ordering dering

An Example 22

Rajendra, IIIT Sri City

slide-23
SLIDE 23

Send vs. Send vs. Delivery of Delivery of Messages Messages

Multicast receiver algorithm decides when to deliver a message to a process A received message may be:

delivered immediately (put on a delivery queue that the process reads) placed on a hold-back queue (because we need to wait for an earlier message) rejected/discarded (duplicate or earlier message that we no longer want)

23

Rajendra, IIIT Sri City

slide-24
SLIDE 24

An Illustr An Illustration ation

Sending, delivering and holding back

24

Rajendra, IIIT Sri City

slide-25
SLIDE 25

Global Global Time Or Time Ordering dering

All messages arrive in exact order sent Assumes that two events never happen at exactly the same time!

Why Not? No global clocks … right?

Difficult (impossible) to achieve

25

Rajendra, IIIT Sri City

slide-26
SLIDE 26

Total Or

  • tal Ordering

dering

Consistent ordering everywhere All messages arrive at all group members in the same order

They are sorted in the same order in the delivery queue

Two Conditions:

If a process sends m before m’ then any other process that delivers m’ will have delivered m If a process delivers m’ before m” then every

  • ther process will have delivered m’ before m”

26

Rajendra, IIIT Sri City

slide-27
SLIDE 27

Total Or

  • tal Ordering - Implementation

dering - Implementation

How to implement this?

Attach unique totally sequenced message ID Receiver delivers a message to the application only if it has received all messages with a smaller ID

27

Rajendra, IIIT Sri City

slide-28
SLIDE 28

Causal Or ausal Ordering dering

Partial ordering

Messages sequenced by Lamport or Vector timestamps

Condition: If multicast(G, m) → multicast(G, m’)

then every process that delivers m’ will have m delivered already

If message m’ is causally dependent on the message m, then all processes must deliver m before m’

28

Rajendra, IIIT Sri City

slide-29
SLIDE 29

Causal ausal vs vs Concurr Concurrent ent

An illustrative example

29

Rajendra, IIIT Sri City

slide-30
SLIDE 30

Causal Or ausal Ordering - Implementation dering - Implementation

How to implement CO? Pi receives a message from Pj Each process keeps a precedence vector (similar to vector timestamp) Vector is updated on multicast send and receive events

Each entry = number of the latest message from the corresponding group member that causally precedes the event 30

Rajendra, IIIT Sri City

slide-31
SLIDE 31

Causal Or ausal Ordering - dering - Algorithm Algorithm

When Pj sends a message, it increments its own entry and sends the vector

Vj[j] = Vj[j] + 1 Send Vj with the message

When Pi receives a message from Pj

Check that the message arrived in FIFO order from Pj : Vj[j] == Vi[j] + 1 ? Check that the message does not causally depend on something Pi has not seen ∀k, k ≠ j: Vj[k] ≤ Vi[k] ? If both conditions are satisfied, Pi will deliver the message Otherwise, hold the message until the conditions are satisfied

31

Rajendra, IIIT Sri City

slide-32
SLIDE 32

Causal Or ausal Ordering dering – W Work out

  • rk out

Implementation: Pi receives a message from Pj Each process keeps a precedence vector (similar to vector timestamp) Vector is updated on multicast send and receive events

Each entry = Number of the latest message from the corresponding group member that causally precedes the event message 32

Rajendra, IIIT Sri City

Pj Pi mji

slide-33
SLIDE 33

Causal Or ausal Ordering dering – Example Example

P2 receives message m1 from P1 with V1=(1,1,0) Is this in FIFO order from P1?

Compare current V on P2: V2=(0,0,0) with received V from P1, V1=(1,1,0) Yes: V2[1] = 0, received V1[1] = 1 ⇒ sequential order

Is V1[i] ≤ V2[i] for all other i?

Compare the same vectors: V2=(0,0,0) vs. V1=(1,1,0)

  • No. V1[0] > V2[0] (1 > 0)

Therefore: hold back m1 at P2

33

Rajendra, IIIT Sri City

slide-34
SLIDE 34

Causal Or ausal Ordering dering – Example Example (contd

contd) P2 receives message m0 from P0 with V=(1,0,0) (1) Is this in FIFO order from P0?

Compare current V on P2: V2=(0,0,0) with received V from P2, V2=(1,0,0) Yes: V2[0] = 0, received V1[0] = 1 ⇒ sequential

(2) Is V0[i] ≤ V2[i] for all other i?

Yes

Deliver m0

Now check hold-back queue. Can we deliver m1?

34

Rajendra, IIIT Sri City

slide-35
SLIDE 35

Causal Or ausal Ordering dering – Example Example (contd

contd) Is the held-back message m1 in FIFO order from P0?

Compare current V on P2: V2=(1,0,0) with held-back V from P0, V1=(1,1,0) Yes: V2[1] = 0, received V1[1] = 1 ⇒ sequential

Is V0[i] ≤ V2[i] for all other i?

Now yes. Element 0: (1 ≤ 1), element 2: (0 ≤ 0); Deliver m1

More efficient than total ordering:

No need for a global sequencer. No need to send acknowledgements.

35

Rajendra, IIIT Sri City

slide-36
SLIDE 36

Sync Or Sync Ordering dering

Messages can arrive in any order Special message type

Synchronization primitive Ensure all pending messages are delivered before any additional (post-sync) messages are accepted 36

Rajendra, IIIT Sri City

slide-37
SLIDE 37

Unor Unorder dered multicast ed multicast

Messages can be delivered in different

  • rder to different members

Order per-source does not matter

37

Rajendra, IIIT Sri City

slide-38
SLIDE 38

Multicast Consider Multicast Considerations ations

Follow this order !!

38

Rajendra, IIIT Sri City

slide-39
SLIDE 39

Summary Summary

è Communication Models è Design Issues

è Process Failures

è Message Ordering

è Good / Bad ordering è Various Types of Ordering of messaages

è Group Communication

è Causal ordering based approach

Rajendra, IIIT Sri City

39

slide-40
SLIDE 40

Summary Summary

è Message Ordering and Group Communications

è Design Issues

è Process Failures

è Message Ordering

è Good / Bad ordering è Various Types of Ordering of messaages

è Group Communication

è Causal ordering based approach

è Many more to come up … stay tuned in !!

Rajendra, IIIT Sri City

40

slide-41
SLIDE 41

How to r How to reach me? each me?

è Please leave me an email:

rajendra [DOT] prasath [AT] iiits [DOT] in

è Visit my homepage @

è http://www.iiits.ac.in/FacPages/index- rajendra.html OR è http://rajendra.2power3.com 41

Rajendra, IIIT Sri City

slide-42
SLIDE 42
  • Perspective Students (having CGPA above 8.5

and above)

  • Promising Students (having CGPA above 6.5

and less than 8.5)

  • Needy Students (having CGPA less than 6.5)
  • Can the above group help these students? (Your

work will also be rewarded)

  • You may grow a culture of collaborative

learning by helping the needy students

Help among Yourselves?

42

Rajendra, IIIT Sri City

slide-43
SLIDE 43

… Questions ???

Thanks …

Rajendra, IIIT Sri City

43