Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 5 Naming (I) Speaker : Jyun-Yao Huang 1 Application and Practice of Distributed Systems.

Similar presentations


Presentation on theme: "Chapter 5 Naming (I) Speaker : Jyun-Yao Huang 1 Application and Practice of Distributed Systems."— Presentation transcript:

1 Chapter 5 Naming (I) Speaker : Jyun-Yao Huang (allen501pc@gmail.com)allen501pc@gmail.com 1 Application and Practice of Distributed Systems

2 Introduction In a DS, the implementation of a naming system is itself often distributed – How this distribution is done plays a key role in the efficiency and scalability of the naming system. Three main areas of study in this chapter The organization and implementation of human-friendly naming systems, e.g, WWW system Naming as it relates to mobile entities Describe entities by means of various characteristics (not name) Need to resolve a description by attributes to an entity Application and Practice of Distributed Systems 2

3 Outline Names, Identifiers, and Addresses Flat Naming Structured Naming Attribute-Based Naming 3 Application and Practice of Distributed Systems

4 Names, Identifiers, and Addresses Name: a string of bits or characters that is used to refer to an entity Entity – just about any resource Address – the name of an entity’s “access-point”. Why not use address as an entity’s name An entity may change its access point The original access point may be reassigned to a different entity An entity can have more than one access points A web service may distributed across several servers Application and Practice of Distributed Systems 4

5 Names, Identifiers, and Addresses (cont.) Thus, a name is location independent and much easier to use If it is independent from its addresses Furthermore, some types of names is humanfriendly names Tailored to be used by humans and represented as character string Application and Practice of Distributed Systems 5

6 Names, Identifiers, and Addresses (cont.) Identifiers: a name that has the following properties An identifier refers to at most one entity Each entity is referred to by at most one identifier An identifier always refers to the same entity It is never reused By identifier, it becomes much easier to unambiguously refer to an entity Application and Practice of Distributed Systems 6

7 Name Resolution Name resolution Resolve names and identifiers to addresses! In DS, name resolution is closely related to message routing A naming system maintains a name-to-address binding A table of (name, address) pairs In distributed systems, this binding is distributed A centralized table is not going to work Thus, name resolution may need to repeated route message to each server that maintains the table Ex: DNS Application and Practice of Distributed Systems 7

8 Outline Names, Identifiers, and Addresses Flat Naming Structured Naming Attribute-Based Naming 8 Application and Practice of Distributed Systems

9 Flat Naming Flat names, or unstructured names Identifiers are random bit strings Does not contain any information on how to locate the access point of an entity How to locate an entity when given only its identifier? Simple Solutions Home-Based Approaches Distributed Hash Tables Hierarchical Approaches Application and Practice of Distributed Systems 9

10 Solution to Location Service Simple solutions: both solutions below are applicable only to local area networks Broadcasting and multicasting Forwarding Pointers Home-Based Approaches Distributed Hash Tables Hierarchical Approaches Application and Practice of Distributed Systems 10

11 Simple Solutions 1: Broadcasting and Multicasting Broadcast “where are you?” packets to each machine Each machine checks if it has the entity ARP (Address Resolution Protocol) uses this method IP address broadcasting return data-link addr Improvement: multicasting to a group of machines Application and Practice of Distributed Systems 11

12 Simple Solutions 2: Forwarding Pointers When an entity moves from A to B, it leaves in A a reference to B Example: SSP chains A forwarding pointer consists (client stub, server stub) Server stub: A local reference to the actual object, or A local reference to a remote client stub for that object When an object moves from A to B Leaves a client stub in A Install a server stub that refers to it in B Application and Practice of Distributed Systems 12

13 Forwarding Pointers Application and Practice of Distributed Systems 13

14 Disadvantages of Forwarding Pointers A chain can become very long The “lookup” eventually becomes prohibitively expensive. Improvement: short cut forward chains Send response with the object’s current location directly to the initiating client stub or along the reverse path If along the reverse path, all nodes in the path would also be “short cut” if possible Big vulnerability: broken links. Break a link and a forwarded entity is lost. Application and Practice of Distributed Systems 14

15 Solution to Location Service Simple solutions: both solutions below are applicable only to local area networks Broadcasting and multicasting Forwarding Pointers Home-Based Approaches Distributed Hash Tables Hierarchical Approaches Application and Practice of Distributed Systems 15

16 Home-Based Approaches Home-based approach A home location keeps track of the current location of an Entity This home can be contacted in order to determine the mobile entities current location Example: Mobile IP Each mobile host uses a fixed IP address All comm to that IP address is directly to its home agent Mobile host use a care-of address when it moves to another network The care-of address is registered to the home age Application and Practice of Distributed Systems 16

17 Home-Based Approaches (Cont.) Drawbacks Increased latency, especially when host and home are far apart The use of fixed home location If move permanently, the home should also move along Application and Practice of Distributed Systems 17

18 Home-Based Approaches Application and Practice of Distributed Systems 18

19 Solution to Location Service Simple solutions: both solutions below are applicable only to local area networks Broadcasting and multicasting Forwarding Pointers Home-Based Approaches Distributed Hash Tables Hierarchical Approaches Application and Practice of Distributed Systems 19

20 Distributed Hash Table-Chord Chord: a peer-to-peer lookup system Given a key (data item), it maps the key onto a node (peer). Application and Practice of Distributed Systems 20

21 General Mechanism Use hash function to assign each node and key an m- bit identifier Identifiers are ordered on an identifier circle Key k is assigned to the first node whose identifier is the smallest identifier id >= k This node is the successor node of key k, denoted by succ(k) Application and Practice of Distributed Systems 21

22 Hashing - Successor Nodes Application and Practice of Distributed Systems 22

23 Node Join and Departure When a node n joins the network Certain keys previously assigned to n’s successor now become assigned to n. When node n leaves the network All of its assigned keys are reassigned to n’s successor. Application and Practice of Distributed Systems 23

24 Consistent Hashing – Node Join Application and Practice of Distributed Systems 24

25 Consistent Hashing – Node Dep. Application and Practice of Distributed Systems 25

26 Key Lookup: Simple Scheme Using Linear Search Algorithm If each node knows only its successor node All node can be visited in linear order. Thus, queries for a given identifier could be passed around the circle Until they encounter the node that contains the key. Application and Practice of Distributed Systems 26

27 A Simple Lookup Scheme The path taken by a query from node 8 for key 54: Application and Practice of Distributed Systems 27

28 Key Lookup: Scalable Scheme To accelerate lookups, Chord maintains additional routing information, called finger table Each node n’ maintains a routing table with up to m entries (m: number of bits in identifiers), called finger table. The i th entry in the table at node n contains the identity of the first node s that succeeds n by at least 2 i-1 on the identifier circle. s = successor(n+2 i-1 ). s is called the i th finger of node n, denoted by n.finger(i) Application and Practice of Distributed Systems 28

29 Scalable Scheme – Finger Tables Application and Practice of Distributed Systems 29

30 Scalable Scheme – Example Query The path a query for key 54 starting at node 8: Application and Practice of Distributed Systems 30

31 The Chord algorithm – Scalable node localization Important characteristics of this scheme: Each node stores information about only a small number of nodes (m) Each nodes knows more about nodes closely following it than about nodes farer away The number of nodes that must be contacted to find a successor in an N-node network is O(logN). Application and Practice of Distributed Systems 31

32 Node Joins and Stabilizations The most important thing is the successor pointer If the successor pointer is ensured to be up to date, Then it is sufficient to guarantee correctness of lookups Then finger table can always be verified. Each node runs a “stabilization” protocol periodically in the background To update successor pointer and finger table Application and Practice of Distributed Systems 32

33 The Chord algorithm – Node joins and stabilization Application and Practice of Distributed Systems 33

34 The Chord algorithm – Node joins and stabilization Application and Practice of Distributed Systems 34

35 The Chord algorithm – Node joins and stabilization Application and Practice of Distributed Systems 35

36 The Chord algorithm – Node joins and stabilization Stabilization protocol: Join(): when node n first starts, it calls join() Stabilize(): n asks its successor for its predecessor p and decides whether p should be n‘s successor instead This is the case if p recently joined the system. Notify(): notifies n‘s successor of its existence, so it can change its predecessor to n Fix_fingers(): updates finger tables Application and Practice of Distributed Systems 36

37 The Chord algorithm – Node joins and stabilization When node n first starts, it calls n.join(n’), n’ is any known Chord node. Ask n’ to find the immediate successor of n. join() does not make the rest of the network aware of n Application and Practice of Distributed Systems 37 // join a Chord ring containing node n’. n.join(n’) predecessor = nil; successor = n’.find_successor(n);

38 Node Joins and Stabilization: Example 1 Application and Practice of Distributed Systems 38

39 Node Joins and Stabilization: Example 1 Application and Practice of Distributed Systems 39

40 Node Joins and Stabilization: Example 1 Application and Practice of Distributed Systems 40

41 Node Joins and Stabilization: Example 1 Application and Practice of Distributed Systems 41

42 Node Joins and Stabilization: Example 2 Application and Practice of Distributed Systems 42

43 Node Joins – fix_fingers() Each node periodically calls fix_fingers() To make sure that finger table entries are correct. Node n simply needs to find the successor for k = n+2 i-1 for each entry Application and Practice of Distributed Systems 43 // called periodically. refreshes finger table entries. n.fix_fingers() next = next + 1 ; if (next > m) next = 1 ; finger[next] = find_successor(n + 2next-1);

44 Node Failures Each node maintains a successor-list of its r nearest successors on the ring Successor lists are stabilized as follows: node n builds its list with its successor s by copying s’s successor list, removing its last entry, and prepending s to it. If node n notices that its successor has failed It replaces it with the first live entry in its successor list It rebuilds its successor list with its new successor. Application and Practice of Distributed Systems 44

45 Successor Lists for Node Failures Application and Practice of Distributed Systems 45

46 Exploiting Network Proximity In chord, requests may be routed erratically across the Internet E.g., node 18 in U.S., node 20 in Europe, node 38 in Asia Solutions: make a DHT-based system aware of the underlying network Topology-based assignment of node identifiers Proximity routing Proximity neighbor selection Application and Practice of Distributed Systems 46

47 Topology-based Assignment of Node Identifiers Assign identifiers such that two nearby nodes will have identifiers that are close to each other Disadvantages Complexity Map a logical ring to the Internet is far from trivial Expose correlated failures When the network becomes unreachable=> a gap in uniform distribution identifiers Application and Practice of Distributed Systems 47

48 Proximity Routing Each node maintains a list of alternatives to forward a request Each node maintain r successors Besides, each finger table entry can even have r nodes, within the range [n+2 i-1, n+2 i -1] When forward a lookup request Pick one of the r successors that is closest to itself Application and Practice of Distributed Systems 48

49 Proximity Neighbor Selection Optimize routing tables such that the nearest node is selected as neighbor When there are more nodes to choose from But, cannot apply to chord Instead, in chord, if each finger table entry has r nodes Identify the closest r neighbors Application and Practice of Distributed Systems 49


Download ppt "Chapter 5 Naming (I) Speaker : Jyun-Yao Huang 1 Application and Practice of Distributed Systems."

Similar presentations


Ads by Google