分布式系统
Distributed Systems · 46 notes
- 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.
- 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.
- 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.
- 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.
- 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.
- 1.6 BASEhistorical
BASE trades strong consistency for availability, allowing temporary differences during failures while requiring eventual consistency.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 3.2 Distributed Consensus Algorithm: ZABhistorical
This page links to the ZAB protocol notes for further reading on ZooKeeper's atomic broadcast protocol.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 4.4 Distributed-System Replication Logshistorical
Replicas commonly track data changes through replication logs. These notes compare approaches by their log formats.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.