当前位置:网站首页>Microservice avalanche problems and Solutions
Microservice avalanche problems and Solutions
2022-07-23 18:02:00 【Liu Chu, Ge Nian】
List of articles
Avalanche problem
Avalanche problem
In microservice , The relationship between services is complicated , A microservice often depends on multiple other microservices .

Pictured , If the service provider I Something went wrong , Part of the business of the current application depends on services I, Therefore, it will also be blocked . here , Others do not depend on services I Our business seems unaffected .

however , dependent service I Your service request is blocked , The user will not get a response , be tomcat This thread will not release , As a result, more and more user requests come , More and more threads will block :

The server supports a limited number of threads and concurrency , Requests keep blocking , Will cause the server to run out of resources , As a result, all other services are unavailable , Then the current service is unavailable .
that , Other services that depend on the current service over time , It will eventually become unavailable , Cascading failed , An avalanche happened :

Solution
There are four common ways to solve the avalanche problem :
1. timeout handler
timeout handler : Set the timeout , If the request exceeds a certain time and there is no response, an error message is returned , Will not wait endlessly

2. Bin wall mode
programme 2: Bin wall mode
The silo wall model comes from the design of the cabin :

The cabin will be separated into multiple independent spaces by partitions , When the hull is damaged , It will only cause part of the space to enter , Control the fault within a certain range , Avoid flooding the whole hull .
It's similar to , The warehouse wall mode can limit the number of threads that can be used by each business , Avoid exhausting the whole tomcat Resources for , Therefore, it is also called thread isolation .

3. Circuit breaker
Breaker mode : from Circuit breaker Statistics the abnormal proportion of business execution , If the threshold is exceeded, it will Fuse The business , Intercept all requests to access the service .
The circuit breaker counts the number of requests to access a service , Abnormal proportion :

When found accessing the service D When the proportion of abnormal requests is too high , Think service D There is a risk of avalanches , Will block access to the service D All your requests , Form a fuse :

4. Current limiting
flow control : Restrictions on business access QPS( Number of requests per second ), Avoid service failure due to sudden increase of traffic .

summary
What is the avalanche problem ?
- Micro services call each other , Because a service in the call chain failed , Cause the whole link to be inaccessible .
It can be said that :
Current limiting Is the protection of services , Avoid service failure caused by instantaneous high concurrent traffic , To avoid avalanches . It's a kind of The prevention of measures .
timeout handler 、 Thread isolation 、 Degraded fuse When some services fail , Control the fault within a certain range , Avoid avalanches . It's a kind of Remedy measures .
边栏推荐
猜你喜欢

Don't ask me again why MySQL hasn't left the index? For these reasons, I'll tell you all

rust统计文件中单词出现的次数

Analyze optimism replay contract address attack events

rust猜数字游戏

MySQL foundation and performance optimization

rust中的静态分发和动态分发

一次线上频繁FullGC的排查

Trust finds the maximum value in the array

Seata

The larger the convolution kernel, the stronger the performance? An interpretation of replknet model
随机推荐
Mpu9250 sensor
MySQL执行Alter table xx add column报Duplicate entry错误
开源需要专业化
Docker installs redis and starts it as a configuration file
没有发现必备补丁文件‘NewopUI.pak’?
参与开源社区还有证书拿?
SAP HANA数据库备份失败解决办法
MySQL field modification
李宏毅《机器学习》丨7. Conclusion(总结)
Seata
Start multiple redis instances on a Linux machine
PDO operation
能与PowerDesigner媲美的数据库建模工具PDMan[通俗易懂]
leetcode刷题:动态规划05(不同路径 II)
Comparison of several operation and maintenance tools
TwinCAT 3 first run error 4115
el-input使用
What about the reason why GOM and GEE set up a black screen and the fact that individual equipment maps are not displayed?
Leetcode skimming: dynamic planning 04 (different paths)
网页基础模版