What is a distributed hash table?

A distributed hash table (DHT) is a decentralized storage system that provides lookup and storage schemes similar to a hash table, storing key-value pairs.

Each node in a DHT is responsible for keys along with the mapped values. Any node can efficiently retrieve the value associated with a given key.

Just like in hash tables, values mapped against keys in a DHT can be any arbitrary form of data.

svg viewer

DHTs have the following properties:

  • Decentralised & Autonomous: Nodes collectively form the system without any central authority.
  • Fault Tolerant: System is reliable with lots of nodes joining, leaving, and failing at all times.
  • Scalable: System should function efficiently with even thousands or millions of nodes.

Just like hash tables, DHTs support the following 2 functions:

  1. put (key, value)
  2. get (key)

The nodes in a DHT are connected together through an overlay network in which neighboring nodes are connected. This network allows the nodes to find any given key in the key-space.

svg viewer

Free Resources

Copyright ©2024 Educative, Inc. All rights reserved