当前位置:网站首页>Introduction and response to high concurrency
Introduction and response to high concurrency
2022-07-02 22:50:00 【Ximu Qi】
High concurrency
One 、 Introduction of high concurrency
What we call high and pointed out two aspects , The first aspect refers to that there are a large number of requests to access the system at the same time The second aspect refers to that there are a large number of requests to access the system in a period of time , There is an indicator in the general time period , Is the number of requests that can be processed in one second .
Two 、 High concurrency processing
2.1、 Improve the performance of a single server
For example, add memory ,CPU Auditing and so on .
2.2、 Deploy multiple machines to share the pressure
Use the help of load balancing , At the same time, the program needs to support the deployment of load balancing , For example, introduce Redis To unify storage Session;
2.3、 If the capacity of a single machine is limited , Far below the ceiling , You need to find performance bottlenecks :
2.3.1 database
Use read-write separation 、 Sub database and sub table 、 Multimaster 、 Improve the database processing capacity from the architecture ;
2.3.2 Introduce caching mechanism
Store data in memory , That is, the cache mechanism is introduced , Check the cache first , Query the database if it does not exist in the cache , Then store it in the cache .【 Cache consistency issues : You can subscribe binlog journal , perhaps MQ Methods to ensure the final consistency of data 】
2.3.3 introduce Redis colony
Redis Although the single machine performance is very high , But in order to support high concurrency , Generally, it needs to be deployed in a cluster .
3、 ... and 、 The solution to the problem of data processing ability
The maximum processing capacity of a business is tenthousand a second , But what should I do if there are millions of requests in a second ?
3.1 Use MQ
First put the request in MQ, Line up at the exit to consume according to the processing capacity , This method may require users to wait for a while to process the results , such as : Payment scenario 、 Buying scene 、 Seckill scene, etc .
3.2 Current limiting
If the processing capacity of the system is limited , It can only carry 10000 traffic per second , But what about millions of requests , At this time, the current can also be limited , Let the flow enter the system for processing in batches .
3.3 DNS Load balancing
If the request inlet flow is too large , You can use DNS Load balancing , Distribute the same domain name access to different nodes for processing .
3.4 CDN
Put static resources in CDN To speed up access ;
3.5 Search using ES;
3.6 Split into micro Services
Split the system , Change to micro service , Deploy each module as a cluster independently , That is, each module is a cluster .
3.7 other
In terms of code , Use multithreading to improve processing power , Use connection pooling to reduce database connections 、 The overhead of remote calls .
边栏推荐
- 杰理之如何测试按键的误触率【篇】
- 'when to use const char * and when to use const char []' - when to use const char * and when to use const char []
- 性能优化----严苛模式
- SimpleITK使用——3. 常见操作
- 任务和特权级保护
- Introduction to database system Chapter 1 short answer questions - how was the final exam?
- go 4种单例模式
- go 4種單例模式
- 【外刊】睡眠与减肥
- [foreign journal] sleep and weight loss
猜你喜欢

Socket socket c/s end process
![NC24325 [USACO 2012 Mar S]Flowerpot](/img/cf/86acbcb524b3af0999ce887c877781.png)
NC24325 [USACO 2012 Mar S]Flowerpot

位的高阶运算
![Gas station [problem analysis - > problem conversion - > greed]](/img/15/5313f900abedb46ce82d8ab81af1d7.png)
Gas station [problem analysis - > problem conversion - > greed]

Dahua cloud native load balancing article - the passenger flow of small restaurants has increased

Simpleitk use - 4 Strange question

Graphic view frame

Socket套接字C/S端流程

Commodity information management system (C language document version)

悬镜安全在RSAC2022上斩获Global InfoSec Awards四项大奖
随机推荐
E-commerce system microservice architecture
【微服务|Sentinel】重写sentinel的接口BlockExceptionHandler
How should programmers write logs
#include errors detected. Please update your includePath.
Based on asp Net (used mobile phone sales management system) +asp Net+c # language +vs2010+ database can be used for course design and post design learning
悬镜安全在RSAC2022上斩获Global InfoSec Awards四项大奖
I admire that someone explained such an obscure subject as advanced mathematics so easily
Oracle cursor
Perceptron model and Application
【洛谷P1541】乌龟棋【DP】
Storage unit conversion
PHP implements querying the data matching the date of birth according to the entered age
PHP微信抢红包的算法
`${}`的用法
【AUTOSAR-DCM】-4.3-UDS $22和$2E服务如何读取和写入NVM数据
傑理之修改不需要長按開機功能【篇】
[chestnut sugar GIS] ArcMap - how to batch modify the font, color, size, etc. of annotation elements
Pointer - function pointer
Go condition variable
【板栗糖GIS】arcmap—如何批量修改注记要素的字体,颜色,大小等