Highly concurrent program design - system design level

Survive by day and develop by night.
talk for import biz , show your perfect code,full busy,skip hardness,make a better result,wait for change,challenge Survive.
happy for hardess to solve denpendies.

Table of contents

insert image description here

overview

Highly concurrent program design:

need:

3. If there is no suitable case, there is a case: millions of data are exported to excel files in seconds for actual combat, from thread pool, multi-threading, batch processing, mysql performance tuning, database connection pool tuning, sql tuning, etc. One level has been tuned. In addition, there are actual cases where the MQ producer killed tens of millions of QPS in seconds, and the suggestions can be referred to.

Design ideas

Realize thinking analysis

1. Main indicators

Here we can use regular data structures for store and forward.
Response time: The time it takes for the system to respond to incoming requests. For example, it takes 1 second to open a page, then this 1 second is the response time.

Throughput: Throughput refers to how many requests can be processed per second, just like how many grains of rice you can eat per second when you eat.

Second query rate: The second query rate refers to the number of response requests per second, which is similar to the throughput.

Number of Concurrent Users: The number of users who are carrying normal system functions at the same time.

2. Handle high concurrency solutions

1: System Split

2: redis cache

3: MQ (message queue)
should use mysql but also mysql, use MQ, pour a large number of write requests into MQ, queue up and play slowly, and write slowly after consumption by the later system, and control it within the range of mysql load.

4. The separation of reading and writing
may reach the final database level, and the requirement of anti-high concurrency is still unavoidable, then split a database into multiple libraries, and multiple libraries can resist higher concurrency; then split a table into multiple tables , keep the amount of data in each table a little less, and improve the performance of SQL running.

The peak QPS and TPS of your system are 10,000, so you can perform stress testing at 100 times, and 100 times is a million level. It is best to write a multi-threaded program for stress testing. You can also use jmeter, loadrunnner and other related tools for high-concurrency stress testing. In the case of million-level high-concurrency stress testing, optimize from the perspective of architecture layers. Which layer has performance problems? , just try to tune the performance of which layer, and the overall performance is as good as possible.

References and Recommended Reading

  1. https://blog.csdn.net/weixin_46048259/article/details/128491043
    2.https://blog.csdn.net/u011277123/article/details/122301282

Welcome to read, old irons, if it is helpful to you, please like and follow! ~

おすすめ

転載: blog.csdn.net/xiamaocheng/article/details/130307668