Script Valley
Interview Prep: System Design Rounds
Advanced Distributed Systems Concepts/Assessment

Practice & Assessment

Test your understanding of Advanced Distributed Systems Concepts

Multiple Choice Questions

6
1

A banking system needs to ensure that a money transfer either fully completes (debit + credit) or fully rolls back. It uses microservices. Which pattern is most appropriate?

2

In the Raft consensus algorithm, what is a 'quorum' and why is it required for a write to succeed?

3

What is the difference between alerting on symptoms vs alerting on causes?

4

When a circuit breaker is in the OPEN state, what happens to incoming requests?

5

Why should exponential backoff include jitter (randomization) when retrying failed requests?

6

What does a 'fencing token' solve in distributed leader election?

Coding Challenges

1
1

Circuit Breaker Implementation

Implement a circuit breaker class with three states: CLOSED, OPEN, HALF_OPEN. Constructor accepts: failureThreshold (N failures to open), resetTimeout (seconds before half-open), successThreshold (successes in half-open to close). Method call(fn) executes fn() if CLOSED or HALF_OPEN. If fn() throws, it's a failure. If fn() returns, it's a success. State transitions: CLOSED → OPEN after failureThreshold consecutive failures; OPEN → HALF_OPEN after resetTimeout seconds; HALF_OPEN → CLOSED after successThreshold consecutive successes; HALF_OPEN → OPEN on any failure. When OPEN, call() must throw CircuitOpenError immediately without calling fn(). Return value is fn()'s return value on success. Include getState() method. Test with: threshold=2, resetTimeout=1, successThreshold=1. Fail twice, verify OPEN, wait 1s, verify HALF_OPEN, succeed once, verify CLOSED. Estimated time: 25 minutes.

Hard

Mini Project

1

Distributed System Health Dashboard

Build a mock microservices observability dashboard as a terminal application or simple web server. Simulate 4 services: API Gateway, User Service, Order Service, Payment Service. Each service emits fake metrics every second: request rate (QPS), error rate (%), and p99 latency (ms). Simulate failure scenarios: one service randomly degrades every 30 seconds (error rate spikes > 5%, latency > 500ms). Implement: a circuit breaker between API Gateway and each downstream service (threshold: 5% error rate opens circuit); an alert that fires when any SLO is breached (error rate > 1% or p99 > 300ms); a dependency graph showing which services are healthy (green), degraded (yellow), or circuit-open (red). Log all circuit state transitions and alert events with timestamps. The goal is to demonstrate that when Payment Service degrades, the circuit breaker isolates it and API Gateway continues serving other requests via fallback.

Hard