KatInterview

Designing a Prepaid Credit Meter for Shared GPU Clusters

System DesignModel answer
HardModel answerSystem Designledgermeteringmulti-tenancy

Last updated

Design a multi-tenant system that reserves, meters, and settles GPU credits across many nodes, with hierarchical budgets, idempotent APIs, and scheduler integration.

You are asked to design the credit accounting layer for a shared GPU platform. Organizations receive credit allowances (say, a monthly allotment), and their users launch jobs that run across a fleet of GPU nodes. Credits must be deducted as compute is actually used.

Cover the following in your design:

  1. Real-time tracking of per-job GPU consumption across many nodes, with credits deducted as work happens.
  2. APIs for granting credits, moving credits down a scope tree (org → project → user), adding purchased credits, reading balances, and charging for jobs.
  3. Enforcement of budgets, per-user and per-project quotas, and rate limits under high concurrency, with no double-spend and only tightly bounded overspend.
  4. Integration with the job scheduler / admission controller so workloads are admitted, throttled, or rejected based on credits and limits.
  5. Both prepaid (hard stop) and postpaid (credit line, invoiced later) billing.
  6. Fair usage when GPUs are scarce — who gets to run first across users and orgs.
  7. Idempotency, consistency model, data model, failure recovery, partitioning/caching, audit logging, reporting, and observability/alerting.

Expect to be pushed on numbers (fleet size, event rates), the consistency guarantees you actually need, and what happens during partial failures.

Hints

Hint 1

The request rate here is small — say so early — and frame the difficulty as correctness under concurrency, not throughput.

Hint 2

Model spending as an authorization-then-capture flow: reserve credits before the job runs, meter while it runs, settle at the end.

Hint 3

Shard by organization so a single hold can check user, project, and org limits in one ACID transaction instead of a distributed one.

Hint 4

Overspend is bounded by lease length × running GPUs × price — tighten leases as balances shrink to shrink the bound.