分布式系统和算法:组通信

多播服务保证了消息被传送给进程组中的所有成员。然而可靠多播的实现被证明是困难的。在本章中,介绍了原子多播、可靠多播、可扩展可靠多播等相关概念,并讲解了在动态组成员的情况下可靠多播例如通过消息排序:完全排序的多播、可靠的按因果关系排序多播的实现方案等。
展开查看详情

1. Group Communication A group is a collection of users sharing some common interest.Group-based activities are steadily increasing. There are many types of groups:  Open group (anyone can join, customers of Walmart)  Closed groups (membership is closed, class of 2000)  Peer-to-peer group (all have equal status, graduate students of CS department, members in a videoconferencing / netmeeting)  Hierarchical groups (one or more members are distinguished from the rest. President and the employees of a company, distance learning).

2. Major issues Various forms of multicast to communicate with the members. Examples are  Atomic multicast  Ordered multicast Dynamic groups  How to correctly communicate when the membership constantly changes?  Keeping track of membership changes

3. Atomic multicast A multicast is atomic, when the message is delivered to every correct member, or to no member at all. In general, processes may crash, yet the atomicity of the multicast is to be guaranteed. How can we implement atomic multicast?

4. Basic vs. reliable multicast Basic multicast does not consider failures. Reliable multicast tolerates (certain kinds of) failures. Three criteria for basic multicast: Liveness. Each process must receive every message Integrity. No spurious message received No duplicate. Accepts exactly one copy of a message

5. Reliable atomic multicast Sender’s program Receiver’s program i:=0; if m is new → do i ≠ n → accept it; send message to member [i]; multicast m; i:= i+1 [] m is duplicate → discard m od fi Tolerates process crashes. Why does it work?

6.Multicast support in networks Multicast is an extremely important operation in networking, and there are numerous protocols for multicast. Sometimes, certain features available in the infrastructure of a network simplify the implementation of multicast. Examples are Multicast on an ethernet LAN IP multicast for wide area networks

7. IP Multicast IP multicast is a bandwidth-conserving technology where the router reduces traffic by replicating a single stream of information and forwarding them to multiple clients. Very popular for for streaming content distribution. Sender sends a single copy to a special multicast IP address (Class D) that represents a group, where other members register.

8. IP Multicast Internet radio. BBC has encouraged UK-based Internet service providers to adopt multicast-addressable services in their networks by providing BBC Radio at higher quality than is available via their unicast-addressed services. Instant movie or TV. Netflix uses a version of IP multicast for the instant streaming of their movies at homes through the Blu-ray Disc players Distance learning. Involves live transmission of the course material to a large number of students at geographically distributed locations.

9. Distribution trees Shared tree source Rendezvous Source tree point Routers maintain & update distribution trees All multicasts are Routed via the whenever members join / leave a group. The Rendezvous point. shared tree is also called core-based tree. Too much load on routers. Application layer multicast overcomes this.

10. Distribution trees The routers have to know about group composition. As groups memberships change, routers have to be updated. Maintaining data about group composition and replicating the copy for each create too much load on routers. Application layer multicast overcomes this. The responsibility of multicast is left to the applications layer. Each multicast is implemented as a series of unicasts, and their routes are carefully planned to reduce the stress on the links.

11. Application Layer Multicast Two examples of application layer multicast with host 0 as the source. (a)The stress on the link from host 0 to router A is 3. (b) The stress on no link exceeds 2.

12. Reverse Path Forwarding RPF is a multicast protocol that uses both source and destination addresses. It guarantees loop-free forwarding of multicast packets to their destinations. It builds a shortest path tree for each source node. Each recipient of a packet from a source node  looks up source address in its own routing table  compares the entry port with receiving interface (the packet must be received from the port that the router would use to forward the return packet. This prevents possible looping as in flooding, IP spoofing etc.)  if wrong interface (other than the shortest path port), drop for each outgoing interface with group members downstream, forward the packet.

13.Reverse Path Forwarding source The blue link denotes the first hop for the return path to the source. The messages represented by the red arrows will be dropped

14. Ordered multicasts: Basic versions only Total order multicast. Every member must receive all updates in the same order. Example: consistent update of replicated data on servers Causal order multicast. If a, b are two updates and a happened before b, then every member must accept a before accepting b. Example: implementation of a bulletin board. Local order (a.k.a. Single source FIFO). Example: video distribution, distance learning using “push technology.”

15. Implementing total order multicast First method. Basic multicast using a sequencer {The sequencer S} sequencer define seq: integer (initially 0} do receive m → multicast (m, seq); seq := seq+1; deliver m od

16. Implementing total order multicast Second method. Basic multicast without a sequencer. Uses the idea of 2PC (two-phase commit) Each process will deliver the messages from the senders in the order (p, r, q)

17. Implementing total order multicast Step 1. Sender i sends (m, ts) to all Step 2. Receiver j saves it in a holdback queue, and sends an ack (a, ts) Step 3. Sender receive all acks, and pick the largest ts. Then send (m, ts, commit) to all. Step 4. Receiver removes it from the holdback queue and delivers m in the ascending order of timestamps. Why does it work?

18. Implementing causal order multicast Basic multicast only. Uses 0,0,0 1,0,0 (1,1,0) 2,1,0 vector clocks. Recipient i will P0 deliver a message from j iff m1 m1 m2 m3 1,1,0 1. VCj(j) = LCj(i) + 1 0,0,0 (2,1,0) P1 (1,0,0) {LC = local vector clock} m2 m3 2,1,1 2. ∀k: k≠j :: VCk: k≠j :: VCk(j) ≤ LCk(i) 0,0,0 (1,0,0) (1,1,0) (2,1,0) P2 ? (violation) VC = incoming vector clock LC = Local vector clock Note the slight difference in the implementation of the vector clocks

19. Reliable multicast Tolerates process crashes. The additional requirements are: Only correct processes are required to receive the messages from all correct processes in the group. Multicasts by faulty processes will either be received by every correct process, or by none at all.

20.A theorem on reliable multicast Theorem. In an asynchronous distributed system, total order reliable multicasts cannot be implemented when even a single process undergoes a crash failure. (Hint) The implementation will violate the FLP impossibility result. Complete the arguments!

21. Scalable Reliable Multicast IP multicast or application layer multicast provides unreliable datagram service. Reliability requires the detection of the message omission followed by retransmission. This can be done using ack. However, for large groups (as in distance learning applications or software distribution) scalability is a major problem. The reduction of acknowledgements and retransmissions is the main contribution in Scalable Reliable Multicasts (SRM) (Floyd et. al).

22. Scalable Reliable Multicast If omission failures are rare, then then instead of using ACK, receivers will only report the non-receipt of messages using NACK. If several members of a group fail to receive a message, then each such member waits for a random period of time before sending its NACK. This helps to suppress redundant NACKs. Sender multicasts the missing copy only once. Use of cached copies in the network and selective point-to-point retransmission further reduces the traffic.

23. Scalable Reliable Multicast Receiving processes have to detect the non receipt of messages from the source. Each member periodically broadcasts a sessions message containing the largest sequence number received by it. Other members figure out which messages they did not receive.

24. Scalable Reliable Multicast Missed m[7] m[7] cached and sent NACK here m[7] Source sending m[0], m[1], m[2] … m[7] cached here m[7] Missed m[7] Missed m[7] and sent NACK and sent NACK

25. Dealing with open groups The view of a process is its current knowledge of the membership. It is important that all processes have identical views. Inconsistent views can lead to problems. Example: Four members (0,1,2,3) will send out 144 emails. Assume that 3 left the group but only 2 knows about it. So, 0 will send 144/4 = 36 emails (first quarter 1-36) 1 will send 144/4 = 36 emails (second quarter 37-71) 2 will send 144/3 = 48 emails (last one-third 97-144) 3 has left. The mails 72-96 will not be delivered!

26. Dealing with open groups Views can change unpredictably, and no member may have exact information about who joined and who left at any given time. These views and their changes should propagate in the same order to all members.

27. Dealing with open groups Example. Current view (of all processes) v0(g) = {0, 1, 2, 3}. Let 1, 2 leave and 4 join the group concurrently. This view change can be serialized in many ways: • {0,1,2,3}, {0,1,3} {0,3,4}, OR • {0,1,2,3}, {0,2,3}, {0,3}, {0,3,4}, OR • {0,1,2,3}, {0,3}, {0,3,4} To make sure that every member observe these changes in the same order, changes in the view should be sent via total order multicast.

28. View propagation {Process 0}: • v0(g); v0(g) = {0,1,2,3}, • send m1, ... ; • v1(g); • send m2, send m3; v1(g) = {0,1,3}, • v2(g) ; {Process 1}: v2(g) = {0,3,4} • v0(g); • send m4, send m5; • v1(g); • send m6; • v2(g) ...;

29. View delivery guidelines Rule 1. If a process j joins and continues its membership in a group g that already contains a process i, then eventually j appears in all views delivered by process i. Rule 2. If a process j permanently leaves a group g that contains a process i, then eventually j is excluded from all views delivered by process i.