Design: Circuit Breaker Pattern Implementation
Design the circuit breaker pattern as a reusable component integrated with service calls. Out of scope: detailed implementation of external services or fallback logic.
Functional Requirements
FR1: Detect failures in calls to external services or components
FR2: Prevent repeated calls to failing services to avoid cascading failures
FR3: Automatically retry calls after a cooldown period
FR4: Provide fallback responses when the external service is unavailable
FR5: Support monitoring of circuit breaker state and metrics
Non-Functional Requirements
NFR1: Handle up to 10,000 requests per second
NFR2: Fail fast with p99 latency under 100ms for service calls
NFR3: Ensure availability of 99.9% for the main application
NFR4: Minimal added latency when circuit breaker is closed (normal operation)
