← Questions

Make sure every cluster job completes

0
AmazonSystem designLast asked Jul 2025

A system design interview question asked in Amazon's technical phone screen, last asked Jul 2025. It tests job orchestration, retries and notifications.

A team submits batches of work to a compute cluster and needs a service that runs every job in a batch and tells the user when the whole batch is done. The cluster offers only two asynchronous calls, submit_job(params) -> job_uuid and check_job_status(job_uuid) -> SUBMITTED | RUNNING | SUCCEEDED | FAILED, with no code behind them for you to see. A client hands the service a list of parameter sets; the service submits one job per set, follows each until it finishes, retries failures and notifies the user once everything has completed. Much of the round is asking the right questions about those two calls before designing.

Requirements

  • Functional: accept a batch of parameter sets; submit and track every job; retry failed jobs; notify the user once when the batch completes, with per-job results; let the user see progress and cancel a batch.
  • Non-functional: survive crashes of the service without losing or duplicating jobs; respect the cluster's rate limits; scale to millions of jobs; detect jobs that are stuck.

Clarifying questions

  • Is submit_job idempotent? If it times out, did the job start?
  • How long do jobs run, and how fast can the status be polled? Is there a rate limit on either call?
  • Is a FAILED job safe to retry, and how many times? Does the user want partial results?
  • Is there a callback or event stream from the cluster, or only polling?
  • What does "notify" mean (email, webhook, message), and must it arrive exactly once?

What a strong answer covers

  • Components: an ingest API, a durable store of batches and jobs, a scheduler and worker pool that submit, a status tracker that polls, and a notifier.
  • A job state machine stored before every external call, so a crash can resume: pending, submitting, submitted with job_uuid, finished. How a lost submit_job response is reconciled (client-side request key, or checking before resubmitting) to avoid duplicates.
  • Fan-out with a concurrency cap and token bucket per cluster; retries with exponential backoff and jitter; a retry limit, then the job is marked failed.
  • Stuck-job detection with a timeout per state; polling on a schedule spread over time, versus callbacks when available.
  • Batch completion as a counter updated in the same transaction as job state, and notifications at least once with a deduplication key so the user sees one.
  • Metrics and alerts: jobs per state, age of the oldest pending job, cluster error rate.

Follow-ups

  • The cluster goes down for an hour. What happens to in-flight batches, and what does the user see?
  • One user submits a batch of 5 million jobs. How do you keep other users' batches moving?
  • How do you support cancelling a batch whose jobs are already running?

Where it's asked

  • Amazon · Technical phone screen · Last asked Jul 202560 min · Live coding in a shared editor that does not run code, plus Leadership Principles questions · No AI

What it tests

job orchestration · retries · notifications

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing