educative.io

How search query will happen in nodes which has replicated partitions?

How search query will happen in nodes which has replicated partitions?

It’s confusing, I thought, write would happen only at primary node/partition (this is confusing what exactly it is) and then the changes would be reflected on replicated nodes?

Is it node/partition, that is also confusing me?

Hi Rushabha_Jain,
The search query will happen the same way it happened when we didn’t have replicas, as shown in the following illustration.

With replicated nodes, we have increased the availability of our system. Now, we can distribute search queries to multiple replicated nodes, so that one node is not overloaded and a client (who initiated the search) could get the result from some near-by datacenter. To see how replication works (for example for primary-secondary mode), please see: Data Replication - Grokking Modern System Design Interview for Engineers & Managers

Answer to the second part of your question: In the search system design discussed in this lesson, indexing and searching are both colocated. The same set of nodes is used for indexing and searching. In this design, index computation is done both on primary and replicated nodes. Another approach (write would happen only at the primary node and then the changes would be reflected on replicated nodes) that you are thinking of is described in the next lesson.

1 Like