Circuit Breaker

Prevents cascading failures by tracking consecutive upstream errors per cluster

Category: Practical
Task: Prevents cascading failures by tracking consecutive upstream errors per cluster

Prerequisites: The product runtime and any backend services referenced by this configuration.

Run it: Use ghcr.io/praxis-proxy/praxis:0.7.2 and follow the first reverse-proxy tutorial to mount and start the configuration.

This configuration comes from the selected release. The example has not been run here; external services are not bundled.

Download the source file.

# Circuit Breaker
#
# Prevents cascading failures by tracking consecutive upstream errors
# per cluster. After the threshold is reached the circuit opens,
# rejecting requests with 503. After the recovery window, one probe
# request is allowed through (half-open). A successful probe closes
# the circuit; a failed probe re-opens it.
#
listeners:
  - name: http
    address: "0.0.0.0:8080"
    filter_chains:
      - main

filter_chains:
  - name: main
    filters:
      - filter: router
        routes:
          - path_prefix: "/"
            cluster: backend
      - filter: circuit_breaker
        clusters:
          - name: backend
            consecutive_failures: 5
            recovery_window_secs: 30
      - filter: load_balancer
        clusters:
          - name: backend
            endpoints:
              - "127.0.0.1:3001"
              - "127.0.0.1:3002"

insecure_options:
  allow_private_endpoints: true # example proxies to local backends