6 key technologies for resisting millions of high concurrency!

Java technology stack

www.javastack.cn

Follow to read more quality articles

Author: Lu Avatar

Source: http://www.cnblogs.com/luxiaoxun/

1. What is high concurrency

High Concurrency is one of the factors that must be considered in the design of Internet distributed system architecture. It usually refers to the design to ensure that the system can process many requests in parallel at the same time.

Some commonly used indicators related to high concurrency are Response Time, Throughput, QPS (Query Per Second), TPS (Transaction Per Second), and the number of concurrent users.

Response time : The time for the system to respond to the request.

Throughput : the number of requests processed per unit time.

QPS : The number of responses to query requests per second.

TPS : The number of response transaction requests per second.

Number of concurrent users : The number of users who carry the normal use of system functions at the same time.

2. Improve the concurrency of the system

There are two main methodological methods for the distributed architecture design of the Internet to improve the concurrency of the system: vertical expansion (Scale Up) and horizontal expansion (Scale Out).

(1) Vertical expansion: Improve the processing capacity of a single machine. There are two ways of vertical expansion:

1) Enhance stand-alone hardware performance, for example: increase the number of CPU cores such as 32 cores, upgrade better network cards such as 10G, upgrade better hard disks such as SSD, expand hard disk capacity such as 2T, expand system memory such as 128G;

2) Improve the performance of the stand-alone architecture, for example: use Cache to reduce the number of IOs, use asynchrony to increase single service throughput, and use lock-free data structures to reduce response time;

(2) Horizontal expansion: As long as the number of servers is increased, system performance can be linearly expanded. Horizontal expansion requires the design of system architecture. How to design horizontally scalable at each layer of the architecture is the focus of this article.

1. System cluster deployment + load balancing

(1) Add a load balancing layer to evenly send requests to the system layer.

(2) The system layer adopts clustered multi-active deployment to bear the initial concurrency pressure.

2. Database sub-database sub-table + read-write separation + distributed database

(1) Sub-database and sub-table : horizontal split, vertical split (too many drawbacks such as related queries).

(2) Separation of read and write: write from the main library and read from the library (data synchronization delay).

(3) Distributed database: TiDB (HTAP, compatible with MySQL protocol, horizontal expansion, distributed transaction)

3. Cache

(1) Local cache: local disk or memory.

(2) Distributed cache : Use the cache cluster to resist a large number of read requests.

(3) Pre-cache, multi-level cache.

4. Message middleware

(1) System decoupling and data synchronization.

(2) Request asynchronous processing to achieve the effect of peak clipping and valley filling.

5. Application split (microservices)

(1) Split by business and reduce coupling.

(2) Hierarchical deployment, expansion and contraction.

(3) Application resource isolation.

6. CDN (Content Delivery Network)

(1) Avoid bottlenecks and links on the Internet that may affect the speed and stability of data transmission, so that content transmission can be faster and more stable.

(2) The CDN can redirect the user's request to the service node closest to the user in real time based on comprehensive information such as network traffic and the link of each node, load status, distance to the user and response time.

The copyright of this article belongs to the author and the blog garden, welcome to reprint, but without the author’s consent, this statement must be retained, and the original link must be given in an obvious place on the article page, otherwise the right to pursue legal responsibility is reserved.

Recent hot articles:

1. I wrote a piece of logic in Java 8, but my colleagues couldn't understand it directly

2. Spring Boot study notes, this is too complete!

3. Hang Tomcat, Undertow performance is very explosive! !

4. Spring Boot is too cruel, release 3 versions at a time!

5. How does Spring Boot integrate Redis quickly?

6、The latest release of "Java Development Manual (Songshan Edition)"

7. Spring Boot Redis implements distributed locks, which is so fragrant!

8. Chinese open sourced a small and complete Java tool library !

9. The Chinese open sourced a super easy to use Redis client! !

10、My colleague wrote a hidden bug, and I checked it for 3 days!

Scan the QR code to follow the official account of the Java Technology Stack to read more dry goods.

Click " Read Original " to get a complete list of interview questions~

Guess you like

Origin blog.csdn.net/youanyyou/article/details/108426582