HLDArena
HLD-250·Messaging & Queues
Medium · 1,000 pts

Multi-Tenant Async Batch LLM Inference & Off-Peak Scheduler

Design an OpenAI / Anthropic Batch API platform where enterprises upload 100k-prompt JSONL files for 24-hour SLA completion at 50% discount, enforcing fair per-tenant token quotas, checkpointed partial progress, and output artifact streaming.

Max p99
≤ 58 ms
Availability
≥ 99.6%
Budget
≤ $5,900

Functional Requirements

  • FR-1POST /v1/batches — Validates input JSONL object manifest, reserves tenant daily token quota, and shards prompts into work queues.
  • FR-2GET /v1/batches/{batch_id} — Returns real-time completed/failed prompt counters and signed output/error JSONL download URLs.
  • FR-3POST /v1/batches/{batch_id}/cancel — Halts remaining unstarted shards cleanly while preserving already-completed output lines.
  • FR-4Must prevent a single whale tenant uploading 10M prompts from starving smaller tenants and survive worker/checkpoint node crashes.

Workload Profile

Steady Batch Submissions24,000 Status & Shard Claim Read RPS / 7,200 Progress Checkpoint Write RPS
Off-Peak Discount Window Surge66,000 Read RPS / 19,500 Checkpoint Write RPS
Active Working Set24 GB active batch manifests, fair-share deficit counters & shard leases
Scheduling GateWeighted fair queuing across tenant_id + idempotent line_id completion

Consistency Model

Read-after-write on batch state transitions (VALIDATING -> IN_PROGRESS -> FINALIZING -> COMPLETED / CANCELED) and shard lease claims.

Relevant practice for

Click an item in Inventory above, or press B to add a component, double-click to name, C to connect.

Design Write-up

Write under ### Architecture for Diagram to take that up directly

Compulsory section · if not written yet, Diagram reads from the start of your write-up.
Architecture: required·FRs mentioned: 0/4·0 boxes · 0 edges
0 words
Hidden Cases #4–#7 run automatically on Submit
Case 1: Smoke & API ContractInput Workload
Read RPS
2,000 rps
Write RPS
400 rps
Key Distribution
Uniform (Low Skew)
Chaos Fault
None (Healthy Cluster)
Expected Pass CriteriaASSERTIONS
• Tail Latency: p99 ≤ 116 ms
• Availability: ≥ 99.6%
Valid end-to-end Client → Compute → Storage topology