HLDArena
HLD-322·Search & Indexing
Hard · 1,500 pts

Sharded HNSW Vector Database & Metadata Filter Engine

Design a Pinecone / Milvus multi-tenant vector database serving low-latency ANN top-K cosine similarity queries with real-time vector upserts and deletes.

Max p99
≤ 55 ms
Availability
≥ 99.5%
Budget
≤ $8,900

Functional Requirements

  • FR-1POST /indexes/{namespace_id}/query — Executes ANN top-K vector search with metadata predicates.
  • FR-2POST /indexes/{namespace_id}/upsert — Writes fresh embeddings into write-ahead delta buffer + HNSW segments.
  • FR-3PATCH & DELETE /indexes/{namespace_id}/query — Updates, cancels, or deletes namespace_id records and immediately invalidates or updates cached state (read-after-write).
  • FR-4Deleted/updated vectors must reflect immediately (read-after-write tombstones) and survive 6x storage brownouts.

Workload Profile

Steady AI Production45,000 ANN Query RPS / 8,000 Vector Upsert RPS
Agentic Burst Peak124,000 Query RPS / 22,000 Upsert RPS
Active Working Set44 GB quantized PQ/HNSW graph layers in memory
Latency Gatep99 <= 55 ms across segment compactions & storage brownouts

Consistency Model

Read-after-write via fresh in-memory delta segment + tombstone bitmap merged at query time.

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