Load balancing for distributed search queries

Load balancing for distributed search queries.

DSE Search uses algorithms to balance the load for distributed search queries by minimizing the number of shards that are queried and reducing the amount of data that is transferred from non-local nodes. Strategies are per search index (per core) and can be changed with dsetool set_core_property. Changes are recognized with RELOAD SEARCH INDEX and do not require restarting the node. Different search indexes can have different values.

Core properties

The core properties for load balancing distributed search queries are:

shard.set.cover.finder

The shard set cover finder calculates how to set cover for a query and specify how one node is selected over others for reading the search data.

Can be one of:
  • STATIC
    Use Results
    • Faster
    • Requires load balanced client
    • 8+ vnodes
    • shard.set.cover.finder=STATIC
    • The same query on a node uses the same token ranges and endpoints.
    • Creates fewer token filters.
    • To get a uniform distribution of shard requests, the client sending the queries must distribute the query requests evenly around the cluster.
  • DYNAMIC
    Use Results
    • Default
    • 8 or fewer vnodes
    • shard.set.cover.finder=RANDOM
    • A uniform distribution of shard requests around the cluster for queries arriving at a single node in the cluster.
    • Creates a large number of unique token filters for each query, particularly with vnodes because of the large number of token ranges.

shard.shuffling.strategy

When shard.set.cover.finder=DYNAMIC, you can change the shard shuffling strategy to one of these values:
  • HOST - Shards are selected based on the host that received the query.
  • QUERY - Shards are selected based on the query string.
  • HOST_QUERY - Shards are selected by host x query.
  • RANDOM - Different random set of shards are selected with each request (default).
  • SEED - Selects the same shard from one query to another.

Changing core properties

Note: Changing core properties is an advanced operation that sets properties in the dse-search.properties resource for the search index.
These example commands show how to change core properties for the demo keyspace and the health_data table.
  1. To change the shard set cover finder:
    dsetool set_core_property demo.health_data shard.set.cover.finder=STATIC
  2. Only when shard.set.cover.finder=DYNAMIC, you can change the shard shuffling strategy:
    dsetool set_core_property demo.health_data shard.shuffling.strategy=query
  3. To recognize the changes on the node, reload the search index:
    RELOAD SEARCH INDEX ON demo.health_data
  4. To view the state of the properties in the dse-search.properties resource:
    dsetool list_core_properties demo.health_data
    Result:
    shard.set.cover.finder=STATIC
Tip: Log files show the loaded DSE search properties. The dsetool list_core_properties command shows only the state of the properties in the dse-search.properties resource.