当前位置:网站首页>[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

边栏推荐
- 防范SYN洪泛攻击的方法 -- SYN cookie
- Video caption (cross modal video summary / subtitle generation)
- Video Caption(跨模态视频摘要/字幕生成)
- 【Debias】Model-Agnostic Counterfactual Reasoning for Eliminating Popularity Bias in RS(KDD‘21)
- 异构图神经网络用于推荐系统问题(ACKRec,HFGN)
- Brpc source code analysis (V) -- detailed explanation of basic resource pool
- 记录一次线上死锁的定位分析
- Learning to pre train graph neural networks
- Add a little surprise to life and be a prototype designer of creative life -- sharing with X contestants in the programming challenge
- Data transmission under the same LAN based on tcp/ip
猜你喜欢
![[dark horse morning post] eBay announced its shutdown after 23 years of operation; Wei Lai throws an olive branch to Volkswagen CEO; Huawei's talented youth once gave up their annual salary of 3.6 mil](/img/d7/4671b5a74317a8f87ffd36be2b34e1.jpg)
[dark horse morning post] eBay announced its shutdown after 23 years of operation; Wei Lai throws an olive branch to Volkswagen CEO; Huawei's talented youth once gave up their annual salary of 3.6 mil

Intelligent information retrieval(智能信息检索综述)

氢能创业大赛 | 国家能源局科技司副司长刘亚芳:构建高质量创新体系是我国氢能产业发展的核心

【AI4Code】《CodeBERT: A Pre-Trained Model for Programming and Natural Languages》 EMNLP 2020

马斯克的“灵魂永生”:一半炒作,一半忽悠

Feign使用
![[multimodal] transferrec: learning transferable recommendation from texture of modality feedback arXiv '22](/img/02/5f24b4af44f2f9933ce0f031d69a19.png)
[multimodal] transferrec: learning transferable recommendation from texture of modality feedback arXiv '22

创新突破!亚信科技助力中国移动某省完成核心账务数据库自主可控改造

【AI4Code】《GraphCodeBERT: Pre-Training Code Representations With DataFlow》 ICLR 2021
![[multimodal] hit: hierarchical transformer with momentum contract for video text retrieval iccv 2021](/img/48/d5ec2b80cd949b359bcb0bcf08f4eb.png)
[multimodal] hit: hierarchical transformer with momentum contract for video text retrieval iccv 2021
随机推荐
Application and innovation of low code technology in logistics management
Feign use
[high concurrency] a lock faster than read-write lock in high concurrency scenarios. I'm completely convinced after reading it!! (recommended Collection)
知识图谱用于推荐系统问题(MVIN,KERL,CKAN,KRED,GAEAT)
Power Bi -- these skills make the report more "compelling"“
OSPF综合实验
嵌套事务 UnexpectedRollbackException 分析与事务传播策略
PHP one server sends pictures to another. Curl post file_ get_ Contents save pictures
Learning to Pre-train Graph Neural Networks(图预训练与微调差异)
【GCN-RS】Towards Representation Alignment and Uniformity in Collaborative Filtering (KDD‘22)
Eureka registration center opens password authentication - record
Transformer variants (routing transformer, linformer, big bird)
Hystrix使用
Video caption (cross modal video summary / subtitle generation)
Atomic 原子类
flink sql client 连接mysql报错异常,如何解决?
logstash
Brpc source code analysis (V) -- detailed explanation of basic resource pool
scrapy 设置随机的user_agent
Resttemplate and ribbon are easy to use