雪崩效应:在微服务分布式系统中,服务间都是相互调用的,不考虑外部因素,当服务A不可用时,调用服务A的服务B则会强制等待直至超时,一个请求对应一个线程,强制等待即线程阻塞,在请求超时时这个线程才会被释放,在高并发的应用系统中,随着时间推移,到最后线程会被耗尽,服务B也不可用。下层服务导致上层服务不可用并逐渐扩大服务范围。
<dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> 复制代码
management: endpoints: web: exposure: include: '*' 复制代码
http://localhost:9001/actuator/sentinel
,响应结果如下则整合成功 { "appName":"mg-user-service", "consoleServer":"localhost:8080", "coldFactor":"3", "rules":{ "systemRules":[], "authorityRule":[], "paramFlowRule":[], "flowRules":[], "degradeRules":[] }, "metricsFileCharset":"UTF-8", "filter":{ "order":-2147483648, "urlPatterns":[ "/*" ], "enabled":true }, "totalMetricsFileCount":6, "datasource":{}, "clientIp":"192.168.0.102", "clientPort":"8719", "logUsePid":false, "metricsFileSize":52428800, "logDir":"/Users/gaozaoshun/logs/csp/" } 复制代码