HLDArena
HLD-247·Caching & Edge
Medium · 1,000 pts

Low-Latency IDE Code Completion & Fill-in-Middle Gateway

Design a Copilot / Cursor-style inline ghost-text completion gateway handling keystroke-debounced Fill-in-the-Middle (FIM) requests, repo-context AST snippet caching, and instant in-flight cancellation when the developer keeps typing.

Max p99
≤ 45 ms
Availability
≥ 99.6%
Budget
≤ $5,700

Functional Requirements

  • FR-1POST /v1/completions/fim — Assembles open-tab prefix/suffix + cached repo context and routes to sticky speculative-decoding pools.
  • FR-2PUT /v1/workspaces/{repo_id}/context-index — Incrementally updates local file AST symbol hashes for fast cross-file retrieval.
  • FR-3DELETE /v1/completions/inflight/{request_id} — Aborts superseded keystroke generations immediately to reclaim compute tokens.
  • FR-4Must keep first-token gateway overhead p99 <= 45 ms and isolate slow context storage brownouts.

Workload Profile

Workday Coding Load42,000 Context & Prefix Read RPS / 6,000 AST Sync & Telemetry Write RPS
Global Engineering Peak108,000 Read RPS / 14,500 Write RPS
Active Working Set32 GB hot repo symbol caches, prefix KV pointers & active session state
Latency GateSub-45ms p99 gateway routing + instant stale-keystroke cancellation

Consistency Model

Session-local read-after-write on edited file symbol context so completions reflect just-typed function signatures.

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 ≤ 90 ms
• Availability: ≥ 99.6%
Valid end-to-end Client → Compute → Storage topology