Welcome to FlowZap, the App to diagram with Speed, Clarity and Control.

Circuit Breaker Resilience Architecture

Architecture

A circuit breaker resilience architecture diagram showing the complete state machine with closed, open, and half-open states, failure threshold tracking, recovery timer, and fallback response strategies for protecting services from cascading failures. This template visualizes the circuit breaker pattern in detail, including how the breaker transitions between states based on success and failure counts. Essential for building fault-tolerant microservices that degrade gracefully under load.

Full FlowZap Code

Client { # Client Service
n1: circle label:"Service Call"
n2: rectangle label:"Circuit Breaker Proxy"
n3: rectangle label:"Receive Response"
n4: circle label:"End"
n1.handle(right) -> n2.handle(left)
n2.handle(bottom) -> Breaker.n5.handle(top) [label="Check State"]
n3.handle(right) -> n4.handle(left)
}
Breaker { # Circuit Breaker
n5: diamond label:"Circuit State?"
n6: rectangle label:"Forward Request (Closed)"
n7: rectangle label:"Return Fallback (Open)"
n8: rectangle label:"Test Request (Half-Open)"
n9: rectangle label:"Track Success"
n10: rectangle label:"Track Failure"
n11: diamond label:"Failure Threshold?"
n12: rectangle label:"Trip Circuit Open"
n13: rectangle label:"Reset to Closed"
n14: rectangle label:"Start Recovery Timer"
n5.handle(right) -> n6.handle(left) [label="Closed"]
n5.handle(bottom) -> n7.handle(top) [label="Open"]
n5.handle(left) -> n8.handle(right) [label="Half-Open"]
n6.handle(bottom) -> Downstream.n15.handle(top) [label="Forward"]
n7.handle(top) -> Client.n3.handle(bottom) [label="Cached/Default"]
n8.handle(bottom) -> Downstream.n15.handle(top) [label="Probe"]
n9.handle(right) -> n13.handle(left) [label="Healthy"]
n10.handle(right) -> n11.handle(left)
n11.handle(right) -> n12.handle(left) [label="Exceeded"]
n11.handle(top) -> n6.handle(bottom) [label="Below"]
n12.handle(right) -> n14.handle(left) [label="Cooldown"]
n14.handle(top) -> n8.handle(bottom) [label="Timer Expired"]
}
Downstream { # Downstream Service
n15: rectangle label:"Process Request"
n16: diamond label:"Response OK?"
n17: rectangle label:"Return Success"
n18: rectangle label:"Return Error/Timeout"
n15.handle(right) -> n16.handle(left)
n16.handle(right) -> n17.handle(left) [label="200"]
n16.handle(bottom) -> n18.handle(top) [label="5xx/Timeout"]
n17.handle(top) -> Breaker.n9.handle(bottom) [label="Success"]
n18.handle(top) -> Breaker.n10.handle(bottom) [label="Failure"]
n17.handle(top) -> Client.n3.handle(bottom) [label="Response"]
}

Why This Workflow?

When a downstream service fails, continuing to send requests wastes resources and can cascade failures across the entire system. The circuit breaker pattern detects failures, stops sending requests to unhealthy services, and automatically recovers when the service heals—preventing cascading failures and enabling graceful degradation.

How It Works

  1. Step 1: The circuit breaker proxy intercepts all outbound requests to the downstream service.
  2. Step 2: In the closed state, requests pass through normally and success/failure counts are tracked.
  3. Step 3: When failures exceed the configured threshold, the circuit trips to the open state.
  4. Step 4: In the open state, requests immediately return a fallback response without contacting the downstream service.
  5. Step 5: After a recovery timer expires, the circuit enters the half-open state and sends a test request.
  6. Step 6: If the test succeeds, the circuit resets to closed; if it fails, it returns to open.

Alternatives

Simple retry logic does not prevent cascading failures. Timeout-based approaches waste resources waiting. Libraries like Resilience4j, Polly, or Hystrix implement circuit breakers. This template visualizes the complete state machine for understanding the pattern.

Key Facts

Template NameCircuit Breaker Resilience Architecture
CategoryArchitecture
Steps6 workflow steps
FormatFlowZap Code (.fz file)

Related templates

Serverless Step Functions Orchestration Architecture

Architecture

An AWS Step Functions orchestration architecture diagram with state machine workflows including choice states, parallel processing, wait-for-callback patterns, and compensation rollback for failed steps. This template models serverless workflow orchestration where complex multi-step processes are defined as state machines with built-in error handling and retry logic. Critical for teams building reliable serverless workflows that require human approval or long-running processes.

Bulkhead Isolation Architecture

Architecture

A bulkhead isolation architecture diagram with separate thread pools for critical, standard, and batch workloads, each with independent connection pools, exhaustion detection, and backpressure strategies to prevent one workload from starving others. This template models the bulkhead pattern inspired by ship hull compartments, where resource isolation ensures that a failure or overload in one component cannot cascade to others. Critical for systems requiring guaranteed availability for high-priority operations.

Retry with Exponential Backoff Architecture

Architecture

A retry with exponential backoff architecture diagram showing the complete retry policy engine with retryable vs non-retryable error classification, exponential delay calculation with jitter, max retry thresholds, and graceful exhaustion handling. This template models the essential resilience pattern for handling transient failures in distributed systems, preventing thundering herd problems through randomized backoff delays. Foundational for any service-to-service communication in cloud architectures.

Ambassador Pattern Architecture

Architecture

An ambassador pattern architecture diagram with a local proxy sidecar handling authentication header injection, circuit breaking, retry logic, and metrics collection for outbound requests to external third-party APIs. This template models the ambassador pattern where a helper service running alongside the application offloads cross-cutting concerns for external communication. Useful for teams integrating with unreliable third-party services that need resilience wrappers.

Circuit Breaker Workflow

patterns

Circuit breaker resilience pattern with closed, open, and half-open states for protecting services from cascading failures with automatic recovery testing.

Microservices API Gateway Architecture

Architecture

A microservices API gateway architecture diagram showing request routing, JWT authentication, rate limiting, service discovery, and response aggregation across distributed backend services. This template models the entry point for all client traffic in a microservices ecosystem, enforcing security policies before requests reach internal services. Ideal for platform engineers designing scalable API infrastructure with centralized cross-cutting concerns.

Back to all templates