System design interview questionHardScheduling / Compute

Design an Online Judge like LeetCode

Design a LeetCode-style online judge: accept code submissions and run them asynchronously against test cases.

Interview scope

Client → Gateway/LB → App → Message Queue; workers (App) consume Queue; App → DB for results. No Client → Queue/DB.

Functional requirements

  • Submit code for a problem.
  • Queue execution jobs for workers/sandboxes.
  • Store results and show status to the user.

Scale and quality goals

  • Judging is CPU-heavy — never block the submit HTTP thread on full execution.
  • Need a durable queue and result storage.
  • Scale by adding worker App instances.

Capacity assumption

Design for this scale

Assume ~5M submissions/day (~58 RPS average); each may run multiple tests — workers absorb bursts.

Practice more than a diagram

Place components on the Froquiz canvas, connect the data flow, and see which decisions the scenario-specific review finds missing. The full exercise and review unlock with Premium.

Explore Premium