Microsoft Certified: DevOps Engineer ExpertImplement a Site Reliability Engineering (SRE) strategyMedium
A DevOps team is adopting an SRE strategy for a legacy application that frequently experiences intermittent failures due to upstream dependencies. The team wants to implement a mechanism to prevent these intermittent failures from cascading and overwhelming the service, while still allowing it to recover gracefully. Which design pattern should they implement?
- ALeader-Follower
- BCircuit Breaker
- CRetry with Exponential Backoff
- DBulkhead Pattern
Show answer & explanationAnswer & explanation
Correct answer: B. Circuit Breaker
The Circuit Breaker pattern is designed to prevent a system from repeatedly trying to access a failing upstream service. When failures reach a threshold, the circuit 'opens', blocking further calls to the failing service and allowing it to recover, thus preventing cascading failures and providing graceful degradation.
Why the other options are wrong
- A. The Leader-Follower pattern is for data replication and high availability of data stores, not for handling intermittent failures of upstream services.
- C. Retry with Exponential Backoff helps with transient failures but can exacerbate issues if the upstream service is truly down, as it continues to make requests.
- D. The Bulkhead pattern isolates resources (e.g., thread pools) for different types of calls, preventing one service failure from consuming all resources, but doesn't stop calls to a failing service like a circuit breaker.
Circuit Breaker Pattern
A design pattern that prevents a system from repeatedly invoking a failing service, allowing the service to recover and preventing cascading failures.
- Has three states: Closed, Open, Half-Open.
- Opens when error rate exceeds a threshold.
- Blocks calls to a failing service for a period, then tests if it's recovered.
Memory trick: Like an electrical circuit, open it when things go bad to prevent a meltdown.