System Design Cheat Sheet How to achieve high availability, high throughput, and high scalability

Mondo Technology Updated on 2024-02-12

We often need to design systems with high availability, high scalability, and high throughput. What exactly do they mean?

The picture below is a copySystem Design Cheat Sheet, including the common solutions of the "three highs".

High availability means we need to reach oneHigh level of uptime。We usually describe the design goals as:"3 9's"or"4 9s"。"4 nines", i.e. 9999% uptime, meaning service can only be interrupted for 864 seconds.

To achieve high availability, we need to be in the systemRedundancy by design。There are a few ways to do this:

hot-hot Both instances receive the same input and send the output to the downstream service. If one of them goes down, the other can take over immediately. Since both sides send outputs downstream, downstream systems need to be able to handle duplicate data.

hot-warmTwo instances receive the same input, and only the hot side sends output to the downstream service. If the hot side goes down, the warm side takes over and starts sending output to downstream services.

A single leader instance receives data from the upstream system and replicates it to other replicas.

A leaderless cluster has no leader. Any writes are replicated to other instances. As long as the number of write instances plus the number of read instances is greater than the total number of instances, we get valid data. This is known as quorum.

This means that the service is neededHandle a large number of requests over a period of time。Commonly used metrics are QPS (queries per second) or TPS (transactions per second).

In order to achieve high throughput, we usually do it in the architectureAdd a cacheto avoid passing through slower IO devices such as databases or disks. We can also increase the number of threads for compute-intensive tasks. However, adding too many threads can slow down performance. Therefore, we need to identify the bottlenecks of the system and improve the throughput of the system.

We can also use it in the systemAsynchronous processingto effectively isolate time-consuming and resource-intensive components individually.

High scalability means that the system can be quickly and easily scaled to:Accommodates more capacity(Horizontal Scalability) orMore features(Vertical scalability). Usually, we decide if we need to scale the system by looking at the response time.

To achieve high scalability, you need to isolate the responsibilities of each service. For this reason, microservices are widely adopted. We also leverage service registration and load balancers to route requests to the appropriate instances.

Publish a collection of dragon cards to share millions of cash

Related Pages