Docsity

Distributed Hash Tables: Scalable and Fault-Tolerant File Storage in Distributed Systems, Study notes of Database Management Systems (DBMS)

Partial preview of the text

Download Distributed Hash Tables: Scalable and Fault-Tolerant File Storage in Distributed Systems and more Study notes Database Management Systems (DBMS) in PDF only on Docsity!

Distributed Hash Tables

CS425 /ECE428 – DISTRIBUTED SYSTEMS – FALL 2021

Material derived from slides by I. Gupta, M. Harandi, J. Hou, S. Mitra, K. Nahrstedt, N. Vaidya

Distributed System Organization

  • Centralized
  • Ring
  • Clique
  • How well do these work with

1M+ nodes?

Ring

  • Problems?
  • Fragile
    • O(1) failures tolerated
  • Slow communication
    • O(N) messages

Clique

  • Problems?
  • High overhead
    • O(N) state at each node
    • O(N 2 ) messages for failure detection

Distributed Hash Table

  • A hash table allows you to insert, lookup and delete objects with keys
  • A distributed hash table allows you to do the same in a distributed setting (objects=files)
  • DHT also sometimes called a key-value store when used within a cloud
  • Performance Concerns:
    • Load balancing
    • Fault-tolerance
    • Efficiency of lookups and inserts

Chord

  • Intelligent choice of neighbors to reduce latency and

message cost of routing (lookups/inserts)

  • Uses Consistent Hashing on node’s (peer’s) address
    • (ip_address,port) àhashed id ( m bits)
    • Called peer id (number between 0 and )
    • Not unique but id conflicts very unlikely
    • Can then map peers to one of logical points on a circle m 2 2 - 1 m

Peer pointers (1): successors

N

Say m= N N

N
N
N

(similarly predecessors)

Peer pointers (2): finger tables

Fall'

N

80 + 2^0 80 + 2^1 80 + 2^2 80 + 2^3 80 + 2^4 80 + 2^5 80 + 2^6

Say m= N N i th entry at peer with id n is first peer with id >=

n + 2

i

(mod 2

m

N
N
N

i ft[i] 0 96 1 96 2 96 3 96 4 96 5 112 6 16 Finger Table at N

Search

Fall'

N

Say m= N N File cnn.com/index.html with key K42 stored here Who has cnn.com/index.html? (hashes to K42)

N
N
N

Search

Fall'

N

Say m= N N File cnn.com/index.html with key K42 stored here At node n , send query for key k to largest successor/finger entry <= k if none exist, send query to successor(n) N N

N

Who has cnn.com/index.html? (hashes to K42)

Analysis

Search takes O(log(N)) time

Proof

  • (intuition): at each step, distance between query and peer- with-file reduces by a factor of at least 2 (why?) Takes at most m steps: 2 m is at most a constant multiplicative factor above N, lookup is O(log(N))
  • (intuition): after log(N) forwardings, distance to key is at most 2 m / N (why?) Number of node identifiers in a range of 2 m / N is O(log(N)) with high probability (why?) So using successor s in that range will be ok Here Next hop Key

Analysis (contd.)

  • O(log(N)) search time holds for file insertions too (in general for

routing to any key )

  • “Routing” can thus be used as a building block for
    • All operations: insert, lookup, delete
  • O(log(N)) time true only if finger and successor entries correct
  • When might these entries be wrong?
  • When you have failures

Chord Recap

Each node has an identifier

id=H(address) in the range [0,

m

succ( n ) = node with next largest

ID > n, wrapping around mod 2

m

Node with id connects to:

  • succ (id) (successor)
  • succ ((id+ i

) mod 2

m

) (fingers)

Chord Recap

Each node has an identifier

id=H(address) in the range [0,

m

succ( n ) = node with next largest

ID > n, wrapping around mod 2

m

Node with id connects to:

  • succ (id) (successor)
  • succ ((id+ i

) mod 2

m

) (fingers)

A key k is stored in succ(k)

N N N N N N K K K K K