← 返回 reddit 的题目列表Replace Round-Robin Routing with Least-Latency Routing
类型:online_judge
Problem: Replace Round-Robin Routing with Least-Latency Routing
An existing load balancer chooses backend servers using round robin. Replace it with a least request latency policy: for each new request, select the healthy, non-circuit-broken backend with the lowest predicted request latency.
Provide a design and implementation explanation covering:
The latency statistics maintained for each backend.
A latency-estimation method, such as the latest latency, sliding-window average, or EWMA (exponentially weighted moving average).
How the metric is updated when a backend request completes.
How to handle cold-start backends with no latency history.
How to avoid continually selecting a low-latency backend that already has many queued or in-flight requests.
How health-check and circuit-breaker state filter candidates.
Time complexity per routing decision and optimizations for a large backend pool.
Assume the actual processing or end-to-end latency is available when each request completes.