Skip to content

feat(health-check): implement fail-open when all backends are unhealthy #1204

Closed

Description

@FlorentinDUBOIS

Summary

When all backends in a cluster are marked unhealthy by health checks, Sōzu currently returns NoAvailableBackends — the cluster is effectively down. This can cause a dependency outage (e.g., the /health endpoint's database is down) to cascade into removing ALL backends, which is worse than the original failure.

Per the Amazon Builder's Library — Implementing Health Checks: "If all servers fail health checks simultaneously, the load balancer continues sending traffic to all servers (fail-open)."

Proposal

Add fail-open behavior in BackendList::next_available_backend(): when available_backends() returns empty (all unhealthy), fall back to all backends with BackendStatus::Normal regardless of health state. Emit a warning and a health_check.fail_open metric when this happens.

// After checking primary and backup backends:
if backends.is_empty() {
    // Fail-open: route to all Normal backends when none are healthy
    backends = self.backends.iter()
        .filter(|b| b.borrow().status == BackendStatus::Normal)
        .cloned()
        .collect();
    if !backends.is_empty() {
        warn!("all backends unhealthy for cluster, fail-open: routing to all backends");
        incr!("health_check.fail_open");
    }
}

Context

Labels

enhancement, health-checks

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions