ORIGINAL SYSTEM DESIGN QUESTION
Multi-tenant coding assessment service
Design a code execution service for timed assessments. Keep hidden tests private and isolate arbitrary submissions from application credentials and other tenants.
Original exercise · advanced. Editorial role relevance does not imply a company has asked this question.
Requirements and constraints
- 500 concurrent candidates; each Submit can create up to 10 independent test executions.
- Each program has a two-second CPU limit and a 256 MB memory limit.
- Queue delays must be distinguishable from program runtime; clients may retry requests after a timeout.
Pressure round
A malicious candidate sends an infinite loop while legitimate assessments are near their deadline. Explain isolation, fair scheduling and the evidence you report.
Build and explain the design
Requirements & scope
Who uses it? What must it do? What is explicitly out of scope? State latency, durability and privacy goals.
Self-review guidance
Define language support, test confidentiality, assessment deadlines and trusted grading boundaries.
Capacity estimates
State assumptions, peak requests/second, data volume and retention. Show your arithmetic and units.
Self-review guidance
Translate submissions into test jobs; model peak CPU demand, queue time, compilation overhead and bounded concurrency.
APIs & data model
Describe endpoints/events, entity keys, indexes, authorization, and idempotency.
Self-review guidance
Use an idempotency key, owner-scoped job status, separate queue/program timing, and no client-controlled sandbox limits.
Architecture & data flow
Describe components and request/event paths. Use plain text arrows to sketch your design; explain each responsibility.
Self-review guidance
Separate API, queue, grading and isolated workers. Keep secrets and private expected outputs outside candidate environments.
Failures & observability
What happens on overload, duplicate events, partial failures or lost dependencies? Discuss monitoring and recovery.
Self-review guidance
Consider sandbox escape risk, network denial, tenant cleanup, compilation/timeouts, worker crashes, cost budgets and reconciliation of ambiguous dispatch.
Tradeoffs & alternatives
Compare two plausible approaches. State the costs, consistency model and what would make you change the design.
Self-review guidance
Compare reusable pools with per-job isolation and provider execution with self-hosting. Explain what has been measured versus assumed.
Design guidance describes assumptions and tradeoffs; no architecture has been simulated or benchmarked.
Practice this question
Save your work privately, explain decisions and return to your revision queue.
Open practice workspaceBrowse the question library →