HLDArena
HLD-231·Search & Indexing
Medium · 1,000 pts

Enterprise RAG Document Chunking & Hybrid Vector Search

Design a Glean / Enterprise AI retrieval backend combining ACL-filtered BM25 keyword search + dense vector embeddings with semantic query caching.

Max p99
≤ 68 ms
Availability
≥ 99.5%
Budget
≤ $5,750

Functional Requirements

  • FR-1POST /rag/retrieve — Performs ACL-filtered hybrid lexical + vector retrieval for workspace_id.
  • FR-2POST /rag/ingest — Enqueues document chunking and embedding updates from Slack/Drive webhooks.
  • FR-3PATCH & DELETE /rag/retrieve/{workspace_id} — Updates, cancels, or deletes workspace_id records and immediately invalidates or updates cached state (read-after-write).
  • FR-4Must sustain sub-70ms retrieval p99 when vector index storage experiences 6x latency spikes.

Workload Profile

Workday Copilot Queries25,000 Retrieve RPS / 3,500 Doc Update RPS
All-Hands Search Surge72,000 Retrieve RPS / 9,500 Ingest RPS
Active Working Set30 GB hot workspace HNSW centroids & ACL bitmaps
Traffic DistributionHeavy skew on shared company-wide workspace_id docs

Consistency Model

Read-after-write on document ACL revocations so revoked users immediately lose retrieval visibility.

Design Write-up
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
350 rps
Key Distribution
Uniform (Low Skew)
Chaos Fault
None (Healthy Cluster)
Expected Pass CriteriaASSERTIONS
• Tail Latency: p99 ≤ 136 ms
• Availability: ≥ 99.5%
Valid end-to-end Client → Compute → Storage topology