Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Distributed DNA N-Gram Search Service

Design a distributed index that finds DNA sequences containing a query n-gram with predictable latency and reproducible results.

Problem statement

For this exercise, assume a biotechnology platform stores billions of versioned DNA sequences and scientists search for exact nucleotide substrings. Design the indexing, shard placement, query, update, and recovery paths for an n-gram search service.

Results must respect sequence-version visibility, return stable pagination, and remain reproducible while indexes rebuild. Exclude approximate alignment and protein translation.

What to build

  1. Build searchable n-gram postings for immutable sequence versions and publish an index generation.
  2. Return authorized matching sequence versions with stable pagination and deterministic ranking.
  3. Add new versions and withdraw visibility without corrupting in-flight searches.
  4. Rebuild or rebalance shards while preserving a reproducible query snapshot and recovery path.

At scale

  • Store two billion sequence versions averaging 8,000 bases and sustain 5,000 version publications per second.
  • Serve 20,000 exact-substring queries per second with p95 latency under 500 milliseconds for bounded result pages.
  • Support query strings from 12 to 500 bases and return at most 1,000 matches per page.
  • A shard or zone failure may reduce freshness but must not return a version outside the pinned visibility generation.