KatInterview

Building an Async Prompt-to-Clip Rendering Service on a GPU Fleet

System DesignModel answer
HardModel answerSystem Designml-system-designgpu-schedulingjob-queue

Last updated

Design a durable, fair, and safe asynchronous service that turns text prompts into 10-second clips using slow, expensive GPU inference at roughly ten thousand requests per hour.

Design a Prompt-to-Clip Rendering Platform

You are building a service where users type a text prompt and get back a 10-second video. A pretrained model is available as an opaque function, generate_video(prompt). Each call occupies one top-tier GPU (H100 class) for about 2 to 5 minutes.

What the product must do

  • Accept a prompt through an API and immediately return a job identifier.
  • Let users check progress by polling, or be notified through a webhook when the clip is ready.
  • Keep a browsable history of each user's past clips.

Quality targets

  • Load: about 10,000 submissions per hour.
  • Durability: a job must never vanish because a machine died or a transient error occurred.
  • Safety: harmful prompts must be rejected, and generated output must be screened before anyone can see it.
  • Responsiveness: although rendering is slow, acceptance of a job and the current queue position must be shown right away.

Facts you can rely on

  • A finished clip averages about 50 MB.
  • Model weights are several gigabytes, so loading and caching on GPU machines needs thought.
  • The model is a black box; you cannot assume you can inspect or checkpoint its internals unless you say so explicitly.

Cover in your answer

  1. Overall architecture: gateway, orchestration, and how the services talk to each other.
  2. Queueing and scheduling: managing long-running work and sharing a limited GPU fleet fairly.
  3. Data handling: storing large files, CDN delivery, and metadata.
  4. Failure handling: what happens when a worker dies mid-render.

Include back-of-envelope sizing for GPUs and storage, and call out trade-offs and follow-up considerations such as autoscaling and cost.

Hints

Hint 1

Apply Little's Law (concurrency = arrival rate x time in system) to find how many GPUs are busy at once, then add headroom for peaks and utilization targets.

Hint 2

Treat each job as a state machine with leases and heartbeats; make every state change a conditional update so a stale worker cannot overwrite a newer result.

Hint 3

Use a private staging bucket for raw output, run moderation there, and only promote approved clips to the CDN-backed serving bucket.