Katkat

Debug round-robin request router

DoorDashSoftware Engineer · Technical Screen

Last updated

This interview question evaluates requirements, scale assumptions, API/data design, architecture, trade-offs, failure modes, and rollout in a realistic interview setting. A strong answer for Debug round-robin request router states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.

Given a list of backends and an incoming stream of requests, implement a round-robin request router that returns the next healthy server for each request. Handle server add/remove and health changes, ensure fair rotation with correct wrap-around, and avoid skipped or duplicated assignments. You are given failing tests indicating incorrect routing—identify and fix the bug, then write tests for single server, multiple servers, removal during routing, and health flapping. Analyze complexity and thread-safety considerations.