Hystrix 配置说明:metrics.rollingStats.timeInMilliseconds

Hystrix Configuration clarification: metrics.rollingStats.timeInMilliseconds

我正在尝试了解 metrics.rollingStats.timeInMilliseconds 和 metrics.rollingStats.numBuckets 如何协同工作。

如果我有以下配置:

circuitBreaker.requestVolumeThreshold=20
circuitBreaker.errorThresholdPercentage=50
metrics.rollingStats.timeInMilliseconds=10000
metrics.rollingStats.numBuckets=10

对我来说这意味着: 1) 在做出决定之前,我的 window 中至少需要 20 个请求 2) 达到或超过 50% 的请求将需要失败才能打开断路器

但是桶的数量是如何发挥作用的呢?每个桶的requestVolumeThreshHold和错误阈值是多少?我正在尝试了解 if/how 水桶用于确定断路器跳闸。

我能够通过创建一个测试断路器的简单应用程序来回答我自己的问题。

确定何时打开电路的方程式使用请求量阈值、整个滚动统计时间期间的错误阈值百分比 timeInMilliseconds window。桶仅用于 how/when 滚动 window 更新。