HLDArena
HLD-124·Caching & Edge
Easy · 500 pts

Perceptual Image Hash & Blocklist Moderation API

Design a trust-and-safety hash lookup API checking uploaded media PDQ/PhotoDNA hashes and banned URL signatures before content goes live.

Max p99
≤ 35 ms
Availability
≥ 99.5%
Budget
≤ $2,430

Functional Requirements

  • FR-1POST /moderation/check — Checks perceptual hash_bucket against known policy blocklists.
  • FR-2POST /moderation/signatures — Appends newly flagged perceptual hashes from safety reviewers.
  • FR-3PATCH & DELETE /moderation/check/{hash_bucket} — Updates, revokes, or deletes hash_bucket entries with bounded TTL or explicit cache/index invalidation.
  • FR-4Must keep upload checks under 35ms p99 even if primary signature DB crashes.

Workload Profile

Baseline Uploads21,000 Lookup RPS / 600 Signature Write RPS
Spam Bot Campaign58,000 Lookup RPS / 1,800 Write RPS
Active Working Set10 GB hot perceptual hash prefixes & bloom filters
Traffic DistributionRepeated viral reposts hit identical hash_bucket keys

Consistency Model

Eventual blocklist propagation (< 5s) to edge caches acceptable; new signatures durably stored.

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