Circuit Breaker Pattern Implementation
Implement a Web API client with circuit breaker functionality that blocks requests to a service after 3 failures within 10 minutes, then reopens after a 5-minute recovery period. The system should prevent cascading failures by temporarily stopping calls to unhealthy services.
Asked at:
Uber
Wise
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late April, 2026
Uber
Senior
Early January, 2026
Wise
Staff
If one of Service B or C has a problem, and we keep making API requests to them, it would create extra pressure on the failing service which would only make the problem worse. Ideally if we encounter too many failures under a certain period of time, we should block making requests to give time for the service to recover. To fix the problem we want you to implement a version of a Web API client that: When a number of failures happen, we stop making API requests to that service for a while. For this problem, we should stop calling a Service if we get 3 failures (e.g: Internal Server Error, Timeout) in last 10 minutes, but after 5 minutes we want to open the calls again to the service. Example scenario request being made to Service to B and Service C: Table Request time Service / API Response (status) 12:01 AM GET Service B Success (200) 12:02 AM GET Service B Failed (500) 12:03 AM GET Service B Failed (500) 12:04 AM GET Service B Failed (500) 12:05 AM GET Service B Blocked
Hello Interview Premium
Your account is free and you can post anonymously if you choose.