Preparing your design workspace

Loading the problem and your latest saved attempt…

Design an Adaptive Task Decomposition Queue

Extend a job scheduler to split uneven work into bounded subtasks, schedule it fairly, and aggregate one reliable parent outcome.

Problem statement

For this exercise, assume an existing durable job scheduler handles ordinary independent tasks, but some parent jobs range from seconds to hours and may expand into as many as 100,000 subtasks.

Design the extension that creates bounded work units, schedules mixed workloads fairly, adapts to skew and stragglers, and reports one trustworthy parent result. Retries, cancellation, and worker loss must not double-count successful work.

Exclude arbitrary user-authored workflow graphs and cross-parent transactional side effects.

What to build

  1. Accept a parent job and incrementally create bounded, uniquely identified subtasks from its input.
  2. Dispatch subtasks across worker capabilities without one huge parent starving shorter work.
  3. Track progress and produce one terminal parent result from committed subtask outcomes.
  4. Retry leases, handle worker loss, and propagate cancellation without double counting or unbounded expansion.

At scale

  • Accept 1,000 parent jobs per second and maintain up to 1 million active subtasks across worker pools.
  • A parent may expand from one subtask to 100,000 subtasks, with individual runtimes ranging from seconds to hours.
  • Dispatch runnable work within two seconds at p95 while enforcing per-tenant concurrency and queue-age fairness.
  • Retain parent and subtask outcomes for 30 days; worker loss may delay completion but must not double-count committed output.