Are queries routed to the primary OR a replica, or the primary AND all replicas?

(Andrew Rueckert) #1

I have an index that is 1 shard with 2 replicas, and only 3 nodes in the cluster. If I make a query against this index, is it randomly routed to 1 node in the cluster, or is it routed to all nodes in the cluster (and a response accepted from whichever shard responds first)?

If I have a low-data, write-light, and query-heavy workload (like percolation), am I better served by having more nodes, and a replica on each? Or does adding another node with another copy of the data just mean that I have 4 nodes running every query instead of 3?

(Loren Siebert) #2

The query is routed to one shard copy (primary or a replica).

Which copy gets chosen depends on what version you are running, and whether you have indicated any shard preferences.

The default is round-robin, but the docs for 6.4 still suggest using preference to tune for search speed, although that is going away in 7.0. You have adaptive replica selection as an option, too.

I'd suggest benchmarking to see which approach works best for your use case.

(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.