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. Business System Design Analysis Methodhistorical

    Business-system analysis begins with requirements and prototypes, followed by actors, flows, and data relationships. These notes organize the design process around those steps.

  3. 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.

  4. Handling Massive Datahistorical

    When data cannot fit into memory at once, it can be split, processed with suitable data structures, and combined. These notes organize examples around that approach.

  5. 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.

  6. Designing a Maintainable Systemhistorical

    Maintaining a system after release can be more complex than building it. These notes examine maintainability through complexity, abstraction, and related design choices.

  7. 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.

  8. Designing a Highly Available Systemhistorical

    Highly available systems anticipate and respond to partial failures. These notes examine fault tolerance and failure handling through the meaning of availability.

  9. 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.

  10. Designing a High-Concurrency Systemhistorical

    High-concurrency systems must handle growing load. These notes begin with load and performance metrics and examine ways to scale reads and writes.

  11. 1.6 BASEhistorical

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

  12. Data Modelshistorical

    A data model connects the real world with computers by describing data characteristics. These notes begin with converting real things into digital data.

  13. 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.

  14. System Designhistorical

    This page collects business-system analysis methods, design cases, and large-scale data processing as an entry point to system-design notes.

  15. 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.

  16. Refactoringhistorical

    Modify code without changing its external behavior in order to improve the program's internal structure. In essence, refactoring means improving the design after the code has been written.

  17. 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.

  18. Service Scalinghistorical

    Capacity planning must distinguish concurrent users from requests per second. These notes begin with PCU and QPS and examine service scaling.

  19. 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.

  20. Software-System Technical Planning Methodologyhistorical

    Software-system technical planning can be examined through the system, technology, and planning itself. These notes unpack the concepts before organizing practical methods.

  21. 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.

  22. Designing a Feed Systemhistorical

    A feed keeps presenting information as the screen scrolls. These notes start with that experience and compare pull, push, and hybrid fan-out approaches.

  23. 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.

  24. Designing a Short URL Systemhistorical

    Short URLs turn ordinary addresses into shorter ones for easier sharing. These notes examine generation and redirection through that requirement.

  25. 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.

  26. Designing an E-Commerce Detail Pagehistorical

    If the data volume is relatively small, a fully static design can be used: the static-generation system queries all product data from the database, renders it into HTML files with Thymeleaf + HTML templates, places the files in the Nginx directory, and serves them through Nginx.

  27. 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.

  28. 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.

  29. 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.

  30. Designing a Leaderboard Systemhistorical

    A ranking system starts with requirements and presentation, followed by ranking updates and queries. These notes examine implementation and maintenance using approaches such as sorted sets.

  31. 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.

  32. Designing User Registration and Loginhistorical

    After login, the system returns a credential used to identify the user in later requests. These notes continue with passwords, verification codes, and third-party login.

  33. 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.

  34. 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.

  35. Designing a Frequency-Control Systemhistorical

    Rate-control logic scattered across business code affects reuse, extension, and maintenance. These notes examine extracting that logic into a shared service.

  36. 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.

  37. 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.

  38. Designing a TCP Frameworkhistorical

    This note organizes TCP framework design through requirements, entity relationships, class diagrams, and sequence diagrams for connection setup and message handling.

  39. 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.

  40. 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.

  41. Designing a Cache Middlewarehistorical

    Cache middleware hides details such as reads, writes, concurrency, eviction, and distribution from applications. These notes organize shared caching capabilities around those responsibilities.

  42. 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.

  43. Designing a TCP Connection Poolhistorical

    A TCP connection pool reuses connections to reduce repeated setup and teardown costs. These notes examine its design from that requirement.

  44. 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.

  45. Designing an RPC Frameworkhistorical

    RPC lets programs invoke remote services through interfaces resembling local procedure calls. These notes examine framework components and flows through that need.

  46. 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.

  47. Designing a Rate-Limiting Systemhistorical

    Rate limiting protects services by controlling access frequency rather than only simultaneous access counts. These notes examine implementations through caller-service relationships.

  48. 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.

  49. Designing an Open APIhistorical

    Open APIs expose data and capabilities to external systems and therefore involve concerns such as authentication and authorization. These notes begin with the distinction from internal APIs.

  50. 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.

  51. Designing an Asynchronous Systemhistorical

    An asynchronous call returns without waiting for its result. These notes examine invocation and result handling through the need for higher throughput.

  52. 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.

  53. Designing an Isolation Systemhistorical

    Isolation separates systems or resources to limit failure propagation and impact. These notes illustrate the design through service machines and databases.

  54. 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.

  55. Designing a Circuit-Breaker Systemhistorical

    A circuit breaker stops calls after errors reach a threshold and later attempts recovery. These notes examine system design through that flow.

  56. 3.2 Distributed Consensus Algorithm: ZABhistorical

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

  57. Designing a Degradation Systemhistorical

    Fallback provides a best-effort service when failures occur. These notes examine its business role and relationship to rate limiting and circuit breaking.

  58. 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.

  59. Designing Timeout and Retryhistorical

    Timeouts prevent remote calls from holding resources indefinitely, while retries attempt recovery from temporary failures. These notes examine their roles and interaction.

  60. 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.

  61. 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.

  62. Designing a Feature-Switch Systemhistorical

    A switch can control feature state through a Boolean setting. These notes examine disabling secondary services and switching features between versions.

  63. 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.

  64. Designing a Playbook Systemhistorical

    A contingency system moves a business into a predefined state, reducing the work and errors of changing switches individually. These notes examine execution approaches.

  65. 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.

  66. 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.

  67. Designing an Error Systemhistorical

    An error system distinguishes critical and ordinary problems before deciding whether to stop or continue. These notes cover codes, context, propagation, and related handling.

  68. 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.

  69. Designing Object Poolinghistorical

    Pooling creates and stores objects in advance, checks them out when needed, and returns them after use to reduce creation and destruction costs.

  70. 4.4 Distributed-System Replication Logshistorical

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

  71. Designing a Cache Systemhistorical

    Designing a Cache System: The speed difference between CPU and disk is huge. Based on the principle of locality, frequently used data is generally loaded into memory to improve access speed.

  72. 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.

  73. 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.

  74. 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.

  75. 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.

  76. 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.

  77. 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.

  78. 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.