Microservices Resilience and Fault Tolerance 2 — Questions and Answers
Question 1: In a circuit breaker, what does the HALF-OPEN state primarily do?
- Permanently blocks all traffic to the failing service
- Allows a limited number of trial requests to test if the service has recovered (Correct answer)
- Caches all responses indefinitely
- Doubles the request timeout on every attempt
Correct answer: Allows a limited number of trial requests to test if the service has recovered
HALF-OPEN lets a few probe requests through to determine whether the downstream service has recovered before fully closing the circuit.
Question 2: What is the main purpose of the bulkhead pattern in microservices?
- Encrypting inter-service traffic
- Isolating resources so a failure in one component cannot exhaust resources used by others (Correct answer)
- Compressing payloads to save bandwidth
- Automatically scaling pods based on CPU
Correct answer: Isolating resources so a failure in one component cannot exhaust resources used by others
The bulkhead pattern partitions resources (like thread pools) so one failing dependency cannot bring down the entire service.
Question 3: Which retry strategy adds randomness to wait times to avoid synchronized retry storms?
- Fixed-interval retry
- Exponential backoff with jitter (Correct answer)
- Immediate retry
- Linear backoff without jitter
Correct answer: Exponential backoff with jitter
Jitter randomizes backoff intervals so many clients do not all retry at the exact same moment, preventing thundering-herd load spikes.
Question 4: A timeout is set too high on a downstream call. What resilience risk does this create?
- Requests fail too fast for users to notice
- Threads and connections stay occupied longer, risking resource exhaustion under load (Correct answer)
- It forces the circuit breaker to never open
- It guarantees retries always succeed
Correct answer: Threads and connections stay occupied longer, risking resource exhaustion under load
Overly long timeouts tie up threads and connections, allowing a slow dependency to cascade into resource starvation.
Question 5: What does graceful degradation mean for a microservice under partial failure?
- The service shuts down completely to protect data
- The service continues providing reduced or fallback functionality instead of failing entirely (Correct answer)
- The service replays all failed requests on restart
- The service blocks until the dependency recovers
Correct answer: The service continues providing reduced or fallback functionality instead of failing entirely
Graceful degradation delivers a reduced experience (e.g., cached or default data) rather than a total outage when a dependency fails.
Question 6: Why is idempotency important when implementing automatic retries?
- It speeds up the network round trip
- It ensures repeated identical requests do not cause duplicate side effects (Correct answer)
- It encrypts the retry payload
- It removes the need for timeouts
Correct answer: It ensures repeated identical requests do not cause duplicate side effects
Idempotent operations can be retried safely because executing them multiple times yields the same result without duplicate effects.
Question 7: What is the role of a fallback in a resilience library like Resilience4j or Hystrix?
- To increase the call timeout automatically
- To provide an alternative response when the primary call fails or the circuit is open (Correct answer)
- To log every successful request
- To shard the database
Correct answer: To provide an alternative response when the primary call fails or the circuit is open
A fallback supplies a default or cached response so callers receive something useful when the primary path fails.
In a circuit breaker, what does the HALF-OPEN state primarily do?