1. 1.1 Distributed Systemshistorical

    Distributed Systems: A system composed of multiple subsystems. The subsystems communicate through a network, and each subsystem consists of multiple machines.

  2. 1.2 How to Implement Distributed Lockshistorical

    Distributed locks coordinate resource access across processes or machines. These notes compare implementations starting from requirements such as atomic lock and unlock operations.

  3. 1.3 How to Implement Distributed IDshistorical

    Distributed IDs must remain globally unique when generated across machines. These notes compare generation approaches through uniqueness and other requirements.

  4. 1.4 How to Implement Distributed Sessionshistorical

    Distributed sessions share user-session state across machines so users do not need to log in again when reaching a different node or system.

  5. 1.5 How to Implement Distributed Storagehistorical

    Distributed storage keeps files across machines to address single-node capacity, performance, and availability limits. These notes organize the requirements and implementation approaches.

  6. 1.6 BASEhistorical

    BASE trades strong consistency for availability, allowing temporary differences during failures while requiring eventual consistency.

  7. 1.7 CAPhistorical

    CAP examines consistency, availability, and partition tolerance in distributed systems. These notes organize the concepts through node-level read and write examples.

  8. 1.8 Distributed-System Cluster Metadata Managementhistorical

    Systems contain both stored data and metadata describing it. These notes begin with that distinction and examine cluster metadata management.

  9. 1.9 Distributed Consistencyhistorical

    Distributed consistency concerns agreement among replicas of the same data. These notes begin with replication delay and examine different consistency guarantees.

  10. 1.10 Distributed Computinghistorical

    Distributed computation can be classified by how it processes data. These notes start with continuously arriving streams and compare stream and batch processing.

  11. 1.11 Distributed-System Communicationhistorical

    After a monolith is split into subsystems, they must communicate to deliver a service together. These notes compare synchronous calls, asynchronous communication, and related implementations.

  12. 1.12 Distributed-System Service Statehistorical

    State consists of program context or data. Requests to a stateful service may need the same node; these notes use this distinction to compare stateful and stateless services.

  13. 1.13 Distributed-System Upgrade and Rollbackhistorical

    Distributed services have multiple instances that must be replaced during releases and rolled back when problems occur. These notes compare deployment and rollback strategies.

  14. 1.14 Distributed-System Failureshistorical

    Node failures and network outages can disrupt distributed systems. These notes organize responses such as failover and fault tolerance and their effects on callers.

  15. 1.15 Distributed-System Node Communicationhistorical

    Distributed nodes exchange metadata such as leader-follower relationships and data placement. These notes organize node discovery, communication, and information propagation.

  16. 2. Distributed Transactionshistorical

    Distributed transactions span multiple database nodes and may involve other data sources such as Redis or MongoDB. These notes organize coordination approaches for cross-node operations.

  17. 2.1 Distributed Transaction Solution: 2PChistorical

    Two-phase commit asks databases to prepare, then commits or rolls back according to the participants' responses. These notes also discuss its use cases and problems.

  18. 2.2 Distributed Transaction Solution: TCChistorical

    TCC first uses Try to check a business operation and reserve resources, then invokes Confirm or Cancel according to the outcome.

  19. 2.3 Distributed Transaction Solution: Reliable-Message Eventual Consistencyhistorical

    Reliable messaging coordinates local transactions across services toward eventual consistency. These notes introduce local message tables and transactional messages through the process diagram.

  20. 2.4 Distributed Transaction Solution: Best-Effort Notificationhistorical

    Best-effort notification is an eventual-consistency transaction approach. These notes use process diagrams to examine notifications, queries, retries, and usage scenarios.

  21. 2.5 Distributed Transaction Solution: Sagahistorical

    Saga gives each participant a forward operation and a compensating operation. If a step fails, compensation handles operations already completed.

  22. 2.6 Distributed Transaction Solution: 3PChistorical

    Three-phase commit splits the preparation process into CanCommit, PreCommit, and DoCommit stages as an extension of two-phase commit.

  23. 2.7 Distributed Transaction Solution: Two Phaseshistorical

    A two-phase transaction separates preparation from commit or rollback. These notes organize database-level 2PC and application-level TCC approaches.

  24. 2.8 Reliable-Message Eventual-Consistency Implementation: Local Message Tablehistorical

    Using points awarded after an order as an example, the service creates the order and writes a message within a local transaction, then uses messaging to drive the points service.

  25. 2.9 Two-Phase Implementation: 2PChistorical

    Two-phase commit first sends prepare requests to participating databases, then uses their responses to decide whether to commit or roll back.

  26. 2.10 Two-Phase Implementation: TCChistorical

    TCC divides an application-level transaction into two phases: Try checks the business operation and reserves resources, followed by Confirm or Cancel according to the result.

  27. 2.11 Best-Effort Notification Implementation: MQhistorical

    After a local transaction, the producer sends a message to MQ. The consumer acknowledges success, requeues on failure, and can query the producer for message status.

  28. 2.12 RocketMQ Transaction Messageshistorical

    RocketMQ transactional messages encapsulate the local-message-table approach in the message queue to coordinate message sending with local transaction execution.

  29. 3. Distributed Consensus Algorithmshistorical

    Consensus algorithms let nodes agree on a decision. These notes introduce their need through writes involving a client and multiple replicas.

  30. 3.1 Distributed Consensus Algorithm: Paxoshistorical

    Paxos is a distributed consensus algorithm proposed by Lamport. These notes cover its roles and execution process through the problem of reaching agreement among nodes.

  31. 3.2 Distributed Consensus Algorithm: ZABhistorical

    This page links to the ZAB protocol notes for further reading on ZooKeeper's atomic broadcast protocol.

  32. 3.3 Distributed Consensus Algorithm: Rafthistorical

    Raft is a distributed consensus algorithm proposed by Diego Ongaro. These notes introduce its roles and process starting from the implementation complexity of Paxos.

  33. 3.4 Distributed Consensus Algorithm: Gossiphistorical

    Distributed Consensus Algorithm: Gossip: An algorithm proposed by Xerox for replicating data among multiple nodes in a distributed database.

  34. 3.5 Distributed Consistency Modelshistorical

    Consistency models place different guarantees on read and write results. These notes begin with strong and weak consistency and organize the related models.

  35. 4. Distributed-System Replicationhistorical

    Replication stores copies of the same data on multiple nodes to improve availability and capacity. These notes organize its concepts, methods, and architectures.

  36. 4.1 Distributed-System Replication Architecture: Leader-Leader Replicationhistorical

    Multi-leader replication allows several leaders to accept writes, each potentially with followers. These notes examine the architecture in multi-datacenter scenarios.

  37. 4.2 Distributed-System Replication Architecture: Leaderless Replicationhistorical

    Distributed-System Replication Architecture: Leaderless Replication: There is no Leader. When the client writes, it sends the write request to all replicas in parallel; when it reads, it similarly sends the read request to all replicas in parallel.

  38. 4.3 Distributed-System Replication Architecture: Leader-Follower Replicationhistorical

    Leader-follower replication has one leader and multiple followers. These notes begin with a single-datacenter scenario and examine requests and replication.

  39. 4.4 Distributed-System Replication Logshistorical

    Replicas commonly track data changes through replication logs. These notes compare approaches by their log formats.

  40. 4.5 Distributed-System Replication Methodshistorical

    Replication modes determine how many replica acknowledgments the leader waits for and when clients receive success. These notes compare synchronous and asynchronous replication.

  41. 4.6 Distributed-System Replication Architecturehistorical

    Replicas can serve different roles, such as leader and follower. These notes use those responsibilities to compare replication architectures.

  42. 5. Distributed-System Partitioninghistorical

    Partitioning splits data across nodes. These notes examine key-to-partition and partition-to-machine mappings and how requests reach their data.

  43. 5.1 Distributed-System Partitioning: Data Splittinghistorical

    Data partitioning aims to spread keys evenly across partitions. These notes compare primary and business keys, followed by range, hash, and other partitioning strategies.

  44. 5.2 Distributed-System Partitioning: Request Processinghistorical

    Routing components send client reads and writes to the nodes holding the target partitions. These notes examine CRUD requests with and without a sharding key.

  45. 5.3 Distributed-System Partitioning: Routing Componentshistorical

    Partition routing can be handled by clients, proxies, or servers. These notes compare how each approach stores partition mappings and forwards requests.

  46. 5.4 Distributed-System Partitioning: Partition Assignmenthistorical

    Partition assignment aims to distribute partitions or nodes evenly across machines. These notes compare static assignment, dynamic assignment, and rebalancing.