thread
and semaphore
.Core Module: shenyu-plugin-hystrix
Core Class: org.apache.shenyu.plugin.hystrix.HystrixPlugin
hystrix
dependency in the pom.xml
file of the gateway.<!-- apache shenyu hystrix plugin start--> <dependency> <groupId>org.apache.shenyu</groupId> <artifactId>shenyu-spring-boot-starter-plugin-hystrix</artifactId> <version>${project.version}</version> </dependency> <!-- apache shenyu hystrix plugin end-->
shenyu-admin
--> BasicConfig --> Plugin --> hystrix
set to enable.It is used to filter traffic for the first time and does not require handle fields.
For more information on selectors and rules configuration, see Selector And Rule Config , only some of the fields are covered here.
thread
and semaphore
.Hystrix handler details:
MinimumRequests
: the minimum number of requests required to trigger a circuit breaker.
ErrorThresholdPercentage
: percentage of exception occurring during that time.
MaxConcurrentRequests
: max concurrent requests.
Sleep
(ms): The recovery time after the circuit breaker.
GroupKey
: It is generally set to: contextPath
.
CallBackUrl
: default url /fallback/hystrix
.
CommandKey
: generally, it is set to a specific path interface.
@RestController @RequestMapping("/test") @ShenyuSpringMvcClient("/test/**") public class HttpTestController { @PostMapping("/testHystrix") public ResultBean ok() { Random random = new Random(); int num = random.nextInt(100); if (num > 20) { throw new RuntimeException(); } return new ResultBean(200, "ok", null); } }
Apache Jmeter
shenyu-admin
--> BasicConfig --> Plugin --> hystrix
set Status disable.