Last modified: January 24, 2026

This article is written in: 🇺🇸

Distributed Database System

A distributed database system (DDS) is a collection of logically interrelated databases distributed across multiple physical locations, connected by a network. The data in these systems might be replicated and/or partitioned among different sites, but the system should ideally appear to the user as a single integrated database.

Internet/Clients
             |
             v
      +---------------+
      | Load Balancer |
      +-------^-------+
              |
       +-------+---------+-----------------+
       |                 |                 |
       v                 v                 v
+-------------+   +-------------+   +-------------+
|   Node 1    |   |   Node 2    |   |   Node 3    |
|  (Shard/Rep)|   | (Shard/Rep) |   | (Shard/Rep) |
+------^------+   +------^------+   +------^------+
       |                |                 |
       +----------Network-----------------+

Motivation

Challenges

Distributed Database Architectures

Shared-Nothing, Shared-Disk, and Shared-Memory

I. Shared-Nothing Architecture

+---------+         +---------+         +---------+
    | Node 1  |         | Node 2  |         | Node 3  |
    | CPU/Mem |         | CPU/Mem |         | CPU/Mem |
    | Disk    |         | Disk    |         | Disk    |
    +----^----+         +----^----+         +----^----+
         |                    |                   |
         |                    |                   |
         +--------- Network---+-------------------+

II. Shared-Disk Architecture

+---------+   +---------+   +---------+
    | Node 1  |   | Node 2  |   | Node 3  |
    | CPU/Mem |   | CPU/Mem |   | CPU/Mem |
    +----^----+   +----^----+   +----^----+
         |           |            |
         +----+------+------+-----+
              |      |      |
              |    Shared   |
              |     Disk    |
              +-------------+

III. Shared-Memory Architecture

|      Shared RAM       |
      +---------+------+------+ 
                |      |
  +-------------v------v-------------+
  |   CPU 1   |   CPU 2   |  CPU 3   |
  | (Node 1)  | (Node 2)  | (Node 3) |
  +----------------------------------+
  |                                  |
  +----------- Shared Disk ----------+

Centralized vs. Decentralized Coordination

Centralized Coordinator

Decentralized / Peer-to-Peer

Data Distribution Strategies

Replication

Replicating data means storing identical copies of data on different nodes. This can improve read performance and fault tolerance but complicates writes (since updates must be propagated).

I. Synchronous Replication

II. Asynchronous Replication

III. Quorum-Based Replication

Example:

| Master (Node1) |
          +--------^-------+
                   |
           Synchronous/Async
                   |
        +----------v----------+
        |   Replica (Node2)   |
        +----------^----------+
                   |
           Synchronous/Async
                   |
        +----------v----------+
        |   Replica (Node3)   |
        +---------------------+

Partitioning / Sharding

Partitioning distributes subsets (partitions or shards) of the data across multiple nodes.

I. Horizontal Partitioning

II. Vertical Partitioning

III. Functional / Entity-Based Partitioning

Example:

Table: USERS
 -----------------------------------------------------
 | user_id | name     | email             | ...
 -----------------------------------------------------

  Partition by user_id range:
     Shard A    Shard B    Shard C

  Shard A (Node 1): user_id < 10000
  Shard B (Node 2): 10000 <= user_id < 20000
  Shard C (Node 3): user_id >= 20000

 +----------+     +----------+     +----------+
 | Shard A  |     | Shard B  |     | Shard C  |
 | (Node 1) |     | (Node 2) |     | (Node 3) |
 +----^-----+     +----^-----+     +----^-----+
      |                |                |
      +--------- Network--------------->+

Distributed Concurrency Control

Concurrency control makes sure correct, consistent results when multiple transactions execute simultaneously on different nodes.

Two-Phase Locking (2PL)

Timestamp Ordering

Optimistic Concurrency Control (OCC)

Distributed Transaction Management

ACID Properties

Two-Phase Commit (2PC)

|  Coordinator     |
           +------------------+
                  |     ^
Phase 1 (Prepare) |     | Phase 2 (Commit / Abort)
                  v     |
        +---------------------+
        | Participant (NodeA) |
        +---------------------+
                 |     ^
                 |     |
        +---------------------+
        | Participant (NodeB)|
        +---------------------+

I. Phase 1 (Prepare):

II. Phase 2 (Commit/Abort):

Three-Phase Commit (3PC)

Distributed Consensus Protocols (Paxos, Raft)

Fault Tolerance & Recovery

Failures in Distributed Systems

Strategies for Fault Tolerance

Logging & Checkpointing

The CAP Theorem

Statement

In a distributed system, it is impossible to simultaneously guarantee:

Consistency (C)
               /\
              /  \
             /    \
            /      \
Partition /         \ Availability
  Tolerance (P)       (A)

Implications

Brewer’s CAP vs. PACELC

Types of Distributed Databases

Homogeneous vs. Heterogeneous

I. Homogeneous Distributed Database

II. Heterogeneous Distributed Database

Relational vs. NoSQL vs. NewSQL

I. Relational Distributed Databases

II. NoSQL (Key-Value, Document, Column-Family, Graph)

III. NewSQL

Practical Design Considerations

Query Processing & Optimization

Caching Strategies

Security

Monitoring & Observability

Summary of Tradeoffs and Principles