当前位置:网站首页>[micro service ~sentinel] sentinel degradation, current limiting, fusing
[micro service ~sentinel] sentinel degradation, current limiting, fusing
2022-07-25 12:15:00 【Classmate Tao Ran】

Here is 【 Microservices ~Sentinel】, Pay attention to me to learn micro services without getting lost
If it helps you , Give the blogger a free praise to show encouragement
You are welcome to comment on the collection ️
Column introduction
【 Microservices ~Sentinel】 At present, it mainly updates micro services , Learn together and progress together .
Introduction to this issue
This issue focuses on Sentinel
List of articles
Common concepts of microservices
The difference between fusing and degradation
Common concepts of microservices
Official website :quick-start
Service avalanche
Service avalanche : In the service of the whole link , A service failure , A situation in which the service of the entire link fails .
There is a whole link service (Service A、Service B、Service C)
Service A The flow suddenly increases , Lead to Service B and Service C Flow also increases .
Service C Because I couldn't resist the request , Become unavailable . Lead to Service B Your request becomes blocked .
When Service B Our resources are exhausted ,Service B It becomes unavailable .
Last Service A Unavailable .

Service failure
Service failure : When the downstream service for some reason suddenly Become unavailable or Response is too slow , Upstream services ensure the availability of their overall services , The target service is no longer invoked , Go straight back to , Rapid release of resources . If the condition of the target service improves, the invocation is resumed .

In the beginning
closedstate , Once the detected error reaches a certain threshold , switchopenstate ;There's going to be one reset timeout, It's about time , Will shift to
half openstate ;Attempt to release part of the request to the back end , Once the detection is successful, the regression
closedstate , Recovery service ;
service degradation
What is service degradation ?
When the downstream service for some reason Response is too slow , Downstream services actively shut down some of the less important services , Free up server resources , Increase response speed !
When the downstream service for some reason Unavailable , The upstream actively invokes some local degradation logic , Avoid caton , Quickly return to the user !
The difference between fusing and degradation
The difference between service fusing and service degradation ?
There are many ways to downgrade a service ! Such as switching down 、 Current limiting the drop 、 Fusing the drop !
Service circuit breaker is one of the demotion modes !
Happen when The downstream service is not available The situation of , Circuit breakers and downgrades must go together .
Service degradation is mostly a business-level process , Fusing is a framework level implementation
Switch the drop
Configure a switch in the configuration center ( Variable ), Change the switch in the configuration center , Decide which services to downgrade
Sentinel Introduce
Sentinel : A highly available flow control and protection component , Ensure the stability of micro Services .
Sentinel In two parts ,sentinel-core And sentinel-dashboard.
sentinel-core Some can support local introduction sentinel-core Integrate and configure the flow restriction rules .
sentinel-dashboard It's in core It can support the maintenance and adjustment of online flow control rules and circuit breaker rules .
core Downgrade

The phenomenon 1
Providers build clusters (8170/8270), The caller calls , At this point, close a service of the provider (8270)
Existing phenomenon : visit 8170 Successful visit , Cannot access 8270
Slightly Caton , Just a moment later , No longer stuck .
The phenomenon 2
Providers build clusters (8170/8270), The caller calls , At this point, close all services of the provider
The phenomenon : cannot access

Degraded operation
Add coordinates

<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>modify yml file , Turn on feign Yes sentinel Support for

feign:
sentinel:
enabled: trueModify the startup class , Turn on feign

package com.czxy;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient // Service discovery
@EnableFeignClients // The remote invocation
public class TestNacosConsumerApplication {
public static void main(String[] args) {
SpringApplication.run(TestNacosConsumerApplication.class, args );
}
}modify Feign Realization
package com.czxy.feign;
import org.springframework.stereotype.Component;
@Component
public class EchoFeignFallback implements EchoFeign {
@Override
public String echo(String string) {
return " Degraded processing :" + string;
}
}package com.czxy.feign;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
// @FeignClient(value = " service name ", path = "controller Configured path " )
@FeignClient(value = "service-provider", fallback = EchoFeignFallback.class )
public interface EchoFeign {
// And nacos-provider-2.1>EchoController The declared method is completely consistent
@GetMapping("/echo/{string}")
public String echo(@PathVariable String string);
}Close service provider , test
Be careful : Need to restart service

边栏推荐
- Transformer变体(Sparse Transformer,Longformer,Switch Transformer)
- 【AI4Code】CodeX:《Evaluating Large Language Models Trained on Code》(OpenAI)
- Hystrix使用
- R语言使用lm函数构建多元回归模型(Multiple Linear Regression)、使用step函数构建前向逐步回归模型筛选预测变量的最佳子集、scope参数指定候选预测变量
- Atomic 原子类
- NLP knowledge - pytorch, back propagation, some small pieces of notes for predictive tasks
- Application and innovation of low code technology in logistics management
- 嵌套事务 UnexpectedRollbackException 分析与事务传播策略
- 【对比学习】Understanding the Behaviour of Contrastive Loss (CVPR‘21)
- Figure neural network for recommending system problems (imp-gcn, lr-gcn)
猜你喜欢

Feign use

Qin long, a technical expert of Alibaba cloud: a prerequisite for reliability assurance - how to carry out chaos engineering on the cloud

scrapy爬虫爬取动态网站

【GCN-RS】MCL: Mixed-Centric Loss for Collaborative Filtering (WWW‘22)

图神经网络用于推荐系统问题(IMP-GCN,LR-GCN)

Innovation and breakthrough! AsiaInfo technology helped a province of China Mobile complete the independent and controllable transformation of its core accounting database

Knowledge maps are used to recommend system problems (mvin, Ctrl, ckan, Kred, gaeat)

PHP curl post length required error setting header header

Add a little surprise to life and be a prototype designer of creative life -- sharing with X contestants in the programming challenge

【GCN-RS】Are Graph Augmentations Necessary? Simple Graph Contrastive Learning for RS (SIGIR‘22)
随机推荐
【图攻防】《Backdoor Attacks to Graph Neural Networks 》(SACMAT‘21)
【GCN】《Adaptive Propagation Graph Convolutional Network》(TNNLS 2020)
Intelligent information retrieval(智能信息检索综述)
NLP knowledge - pytorch, back propagation, some small pieces of notes for predictive tasks
Hardware connection server TCP communication protocol gateway
和特朗普吃了顿饭后写下了这篇文章
keepalived实现mysql的高可用
[high concurrency] I summarized the best learning route of concurrent programming with 10 diagrams!! (recommended Collection)
Eureka使用记录
Scott+Scott律所计划对Yuga Labs提起集体诉讼,或将确认NFT是否属于证券产品
Learning to pre train graph neural networks
防范SYN洪泛攻击的方法 -- SYN cookie
1.1.1 欢迎来到机器学习
【AI4Code】《CodeBERT: A Pre-Trained Model for Programming and Natural Languages》 EMNLP 2020
Week303 of leetcode (20220724)
Start with the development of wechat official account
【多模态】《HiT: Hierarchical Transformer with Momentum Contrast for Video-Text Retrieval》ICCV 2021
After having a meal with trump, I wrote this article
Those young people who left Netease
R语言使用ggpubr包的ggarrange函数将多幅图像组合起来、使用ggexport函数将可视化图像保存为jpeg格式(width参数指定宽度、height参数指定高度、res参数指定分辨率)