AlgoViz

Inside a distributed search system

hard 30 min

How one query is answered by many machines: a coordinator asks every shard, each returns its best few, the lists are merged, and only the winners are fetched.

Where it shows up

The same pattern appears across everyday software.

  • Elasticsearch

    The node that receives a request coordinates it. Query and fetch are separate phases, and a search reports how many shards succeeded and failed.

  • Apache Solr

    SolrCloud divides a collection into shards with replicas of several types. A request is sent on to one replica of each shard.

  • Google's 2003 cluster

    The paper describes cheap machines, many copies, and an index cut into pieces so that one query uses many processors.

  • Shop search

    The first page must be fast and may miss a product for a second. A deadline with partial results fits, with stock and price as a second ranking.

  • Log search

    Queries have a time range. Indices outside the range are skipped, so a scatter over thousands of shards becomes a handful.

  • Legal document search

    A missing document is worse than a slow answer. Partial results are refused, and the timeout is long.