Basic Fault Tolerance Patterns Questions
Understanding common patterns that make systems fault-tolerant: replication (data redundancy across multiple servers), failover (switching to backup when primary fails), circuit breakers (stopping requests to failing services to prevent cascades), retry with exponential backoff (intelligent retrying with delays), timeouts (preventing hanging requests), and graceful degradation (providing partial functionality when components fail). Know when each pattern is appropriate and its trade-offs. Understand that fault tolerance usually involves trade-offs: more replicas cost more but tolerate more failures.
Sample Answer
# Pseudocode (python-style)
def http_request_with_retries(req, max_retries=4, base_backoff=0.5):
attempt = 0
while attempt <= max_retries:
state = circuit_breaker.get_state() # CLOSED, OPEN, HALF_OPEN
if state == "OPEN":
metrics.increment("client.fast_fail")
return Failure("circuit_open")
# allow attempt if CLOSED or HALF_OPEN
start = now()
resp = http_client.send(req, timeout=compute_timeout(attempt))
latency = now() - start
metrics.record("client.request.latency", latency)
if resp.is_success():
circuit_breaker.on_success()
metrics.increment("client.success")
return resp
else:
metrics.increment("client.error")
circuit_breaker.on_failure()
attempt += 1
if attempt > max_retries:
metrics.increment("client.retry_exhausted")
return Failure("retries_exhausted")
# decide backoff: if breaker just moved to OPEN, fast-fail next loop
backoff = jittered_backoff(base_backoff * (2 ** (attempt - 1)))
sleep(backoff)Sample Answer
Sample Answer
Sample Answer
Sample Answer
Unlock Full Question Bank
Get access to hundreds of Basic Fault Tolerance Patterns interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.