hystrix grpc circuit breakers

The previous chapter provides grpc breaker sentinel,

sentinel grpc circuit breakers

However, due to the alarm and monitoring components of the company's online systems are prometheus, and sentinel yet not integrated prometheus, so here it is in some online system or by hystrix

step

1, pom-dependent
<dependency>
            <groupid>org.springframework.cloud</groupid> <artifactid>spring-cloud-starter-netflix-hystrix</artifactid> </dependency> 
2, start the class or classes configuration increases @EnableHystrix
3, increase hystrixCommend comment
 @PostMapping("/grpc")
    @HystrixCommand(fallbackMethod = "fallbackMethod")
    public BaseResponse doGrpc(@RequestBody ReRequest rr){ ...... ....... } public BaseResponse fallbackMethod(@RequestBody ReRequest rr){ ...... ....... } 
4, yml increased configuration
feign:
  hystrix:
    enabled: true
  okhttp: enabled: true httpclient: enabled: false compression: request: enabled: true response: enabled: true hystrix: command: default: execution: timeout: enabled: true isolation: thread: timeoutInMilliseconds: 1000 circuitBreaker: requestVolumeThreshold: 50 threadpool: default: coreSize: 60 maxQueueSize: 200 queueSizeRejectionThreshold: 200 

Note that there will be grpc timeout, set the timeout breaker here should be larger than grpc timeout.

Here Insert Picture DescriptionHere Insert Picture Description

 

Guess you like

Origin www.cnblogs.com/1994jinnan/p/12578078.html