Skip to content

Support half-open state for circuit breaking in Sentinel #154

@thefenghou

Description

@thefenghou

##Sentinel以后会增加熔断半打开状态吗?

Type: feature request

你好,发现目前的DegradeRule中不存在熔断的半打开状态,也就是当熔断窗口时间(timeWindow)到达以后,熔断会关闭,这时如果被调用服务还未恢复,有可能会造成大量请求失败或阻塞。而Hystrix中的熔断有一个半打开状态,只允许个别请求通过,确认被调用服务恢复后才关闭熔断。Sentinel以后有考虑增加这方面功能的改进吗?

        synchronized (lock) {
            if (!cut) {
                // Automatically degrade.
                cut = true;
                ResetTask resetTask = new ResetTask(this);
                pool.schedule(resetTask, timeWindow, TimeUnit.SECONDS);
            }

            return false;
        }

......

    private static final class ResetTask implements Runnable {

        private DegradeRule rule;

        ResetTask(DegradeRule rule) {
            this.rule = rule;
        }

        @Override
        public void run() {
            rule.getPassCount().set(0);
            rule.setCut(false);
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/circuit-breakingIssues or PRs related to circuit breakingkind/featureCategory issues or prs related to feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions