Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Circuit breaker half-open probe strategy | 熔断half-open恢复时支持配置探测次数 #411

Closed
brzyangg opened this issue May 31, 2021 · 3 comments · Fixed by #428
Labels
area/circuit-breaking Issues or PRs related to circuit breaking good first issue Good for newcomers kind/enhancement Category issues or PRs related to enhancement
Milestone

Comments

@brzyangg
Copy link

brzyangg commented May 31, 2021

看wiki文档中描述:

Half-Open 状态:半开状态,该状态下除了探测流量,其余对资源的访问也会被切断。探测流量指熔断器处于半开状态时,会周期性的允许一定数目的探测请求通过,如果探测请求能够正常的返回,代表探测成功,此时熔断器会重置状态到 Closed 状态,结束熔断;如果探测失败,则回滚到 Open 状态。

会允许一定数目的探测请求通过,但是我看代码中:

        if curStatus == HalfOpen {
		if err == nil {
			b.fromHalfOpenToClosed()
			b.resetMetric()
		} else {
			b.fromHalfOpenToOpen(1.0)
		}
		return
	}

处于半开状态时,一次请求,成功或者失败,就会转换状态。
请问这块的逻辑是如我看到的这样只判断接下来一次请求的状态还是?

@sczyh30
Copy link
Member

sczyh30 commented Jun 2, 2021

The probe strategy of half-open state is single-probe in current version. Contributions are welcomed.


目前的实现还是单次探测,欢迎社区一起来完善这一块。

@sczyh30 sczyh30 changed the title 请问下熔断half-open时转换状态的逻辑 Circuit breaker half-open probe strategy | 请问下熔断half-open时转换状态的逻辑 Jun 2, 2021
@sczyh30 sczyh30 added the area/circuit-breaking Issues or PRs related to circuit breaking label Jun 2, 2021
@binbin0325
Copy link
Collaborator

是不是可以考虑,对于熔断规则 增加一个 探测次数的参数。 当断路器打开并且进入周期探测时 对请求数进行累加。

  1. 如果在累加过程中有请求失败 则断路器由半开状态变为打开。
  2. 如果在到达探测次数并且没有请求失败,则断路器变为关闭状态并清空统计指标。

@sczyh30 sczyh30 added good first issue Good for newcomers kind/enhancement Category issues or PRs related to enhancement labels Sep 9, 2021
@sczyh30 sczyh30 changed the title Circuit breaker half-open probe strategy | 请问下熔断half-open时转换状态的逻辑 [Feature] Circuit breaker half-open probe strategy | 熔断half-open恢复时支持配置探测次数 Sep 9, 2021
@sczyh30 sczyh30 linked a pull request Dec 11, 2021 that will close this issue
@sczyh30 sczyh30 added this to the 1.0.4 milestone Dec 11, 2021
@sczyh30
Copy link
Member

sczyh30 commented Dec 11, 2021

Resolved via #428

@sczyh30 sczyh30 closed this as completed Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/circuit-breaking Issues or PRs related to circuit breaking good first issue Good for newcomers kind/enhancement Category issues or PRs related to enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants