Distributed Systems
46 notes
Some notes are currently available only in Chinese. English translations are shown when available.
- 4.6 Distributed-System Replication Architecturehistorical
1. What It Is - Replicas generally have two roles: Leader, responsible for handling client write requests; Follower, synchronizes data from the Leader and can handle client read requests. 2. Categories 2.1. Leader-Follower. 2.2. Leader-Leader. 2.3. Leaderless.
- 5. Distributed-System Partitioninghistorical
1. What Is Partitioning - Split one set of data into multiple parts and store them on different nodes. - There are two layers of mapping: take a field from the data as the key, then map key -> partition; then map partition -> machine/node. 2. Why Partitioning Is Needed - The data volume is too large to store on one node and must be distributed.
- 5.1 Distributed-System Partitioning: Data Splittinghistorical
Distribute keys across partitions/nodes as evenly as possible. 1. Choosing the Split Key 1.1. Primary-Key ID - For example, an auto-increment primary key. The advantage is even data distribution; the disadvantage is that queries by business fields may be slow because all partitions need to be read. 1.2. Business ID - Such as user ID or product ID.
- 5.2 Distributed-System Partitioning: Request Processinghistorical
The routing component routes client read and write requests to the node that contains the corresponding partition. 1. Routing Component. 2. Request Processing 2.1. Add Data - 1. The client generates data containing a sharding key. 2. The client sends the add request to the routing component.
- 5.3 Distributed-System Partitioning: Routing Componentshistorical
1. client - The client locally stores the relationship between partitions and server nodes and directly requests the correct node. 2. proxy - The client requests the routing layer, and the routing layer forwards the request to the correct node. 3. server - The client requests any server node, and that server node forwards the request to the correct node.
- 5.4 Distributed-System Partitioning: Partition Assignmenthistorical
Distribute partitions/nodes across machines as evenly as possible. 1. Assignment Methods 1.1. Static Assignment - Create far more nodes than machines. Advantage: when migrating nodes to other machines, the cluster can still respond externally. Disadvantage: the maximum number of machines is fixed.