The interview problem
A shared service runs thumbnail jobs and expensive video jobs. A large tenant floods its queue and delays small tenants. Design weighted service allocation without pretending all jobs cost the same.
Original practice, not a reported company interview. All scenarios and worked numbers are illustrative. Interview date: not applicable. Sources retrieved September 30, 2026.
1. Scope and assumptions
Assume jobs can be divided into bounded execution quanta, tenant identity is authenticated and fairness is measured in worker-seconds. This is scheduling allocation, distinct from distributed concurrent-work limits.
2. Worked approach
tenant queue → deficit credits → bounded execution quantum → measured-cost reconciliation
Keep a queue per tenant and a deficit counter measured in execution credits. Each round adds credit proportional to the tenant's weight. Dispatch a bounded quantum when affordable; debit measured consumption and reconcile prediction errors. Empty tenants may donate idle capacity, but cap accumulated credit to prevent a returning tenant monopolizing the pool.
Admission limits bound queued bytes and age independently of dispatch fairness. Persist job state and checkpoint tokens so preemption does not repeat completed output. A tenant creating many user accounts still belongs to one billing/control identity. Reserve a small pool for control traffic so cancellation remains responsive.
3. Calculate the example
With three continuously backlogged tenants weighted 1:2:1 and 40 useful worker-seconds available each second, ideal shares are 10, 20 and 10 worker-seconds/s. If their jobs cost 1, 5 and 2 worker-seconds respectively, approximate throughputs are 10, 4 and 5 jobs/s. Equal job counts would be unequal resource service. A non-preemptible 60-second job can block a worker for 60 seconds regardless of the deficit formula.
4. Failure cases and trade-offs
Underestimated job costs let a tenant consume more than its share until reconciliation. Enforce maximum quantum or classify non-preemptible jobs separately. Multiple dispatchers must claim the same credits and jobs atomically or partition tenant ownership with fencing.
Measured-cost scheduling improves fairness but requires instrumentation and checkpoint overhead. Fixed job classes are simpler when costs are predictable. Strict reservations waste idle capacity; bounded borrowing improves utilization while preserving recovery of guarantees.
5. Validate the result
Replay a workload with one flooding tenant, one intermittent tenant and adversarial cost estimates. Compare resource share over stated time windows, p95 waiting time and credit debt. Confirm queue expiration and cancellation release storage as well as compute.
6. Interview follow-ups and self-review
How would memory-heavy jobs change the resource model? What if a task cannot checkpoint?
Reward resource-based shares, an executable dispatch rule, bounded non-preemption and protection against tenant identity splitting.
Sources and related practice
Technical reference: sre.google — Resource-based capacity and per-customer controls; deficit scheduling scenario is an original design.
Exact publication/update date not established in this review. Retrieved September 30, 2026. This reference supports the named technical concept; the proposed workflow and examples are original, not a documented vendor implementation or interview report.
Continue with Limit concurrent work across service instances; Allocate tenant quotas across regions.
Continue your preparation
Choose a connected learning path or browse more System design questions. Read our editorial method and attribution policy.