HLD-247·Caching & Edge
Medium · 1,000 ptsLow-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
Solutions Locked
Sign in and either achieve AC or complete 3 official submissions on this question to inspect community diagrams and writeups.
Loading solutions...
Submission History (0)Select to replay
No submissions yet
Click Submit in the top bar to evaluate against all 7 judge cases and save each run here.
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