本文介绍了电路如何再次闭合?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解Hystrix.我知道当服务调用第三方服务且服务没有响应且超出配置阈值时,电路将打开,而继续呼叫将被短路.

I am trying to understand Hystrix. I understand when a service makes call to a 3rd party service and that service is not responding and threshold has been exceeded than the configuration, circuit will be opened and onward calls will be short circuited.

但是我无法理解电路如何再次闭合.让我们假设我们的服务正在呼叫第三方服务,并且该服务无法正常工作,因此断开了电路.5分钟后,服务已开始正常工作,现在应关闭电路.呼叫服务如何得知第三方服务已开始正常运行,现在应关闭电路?

But I am not able to understand how circuit is closed again. Let us suppose our service is making call to 3rd party service and that service not not working fine so circuit is opened. After 5 minute that service has started working fine now circuit should be closed. How calling service knows this that the 3rd party service has started behaving fine, now circuited should be closed?

推荐答案

实际上有三种状态:OPEN,CLOSED和HALF_OPEN.断路器断开后,经过一定时间后,它就可以让单个请求通过.这是HALF_OPEN状态.如果成功,则断路器将合闸,否则断路器将返回OPEN状态,直到再次经过该时间后,断路器才会再次进入HALF_OPEN状态.您可以使用circuitBreaker.sleepWindowInMilliseconds属性指定从OPEN到HALF_OPEN过渡之间的时间.

There are actually three states: OPEN, CLOSED, and HALF_OPEN. Once the circuit breaker is OPEN and a certain amount of time has passed it lets a single request sneak through. This is the HALF_OPEN state. If successful the circuit breaker is closed, otherwise it returns to the OPEN state until that amount of time has passed again, where it enters the HALF_OPEN state once again. You can specify the amount of time between the transition to OPEN to HALF_OPEN using the circuitBreaker.sleepWindowInMilliseconds property.

这篇关于电路如何再次闭合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 12:22