There were a few discussions around index replication not available in CE and the recommendation of using indexes with different names on each node. If I’ve several nodes and I must create indexes with different names on each of them, won’t it impact insert/upsert performance? I do see these index operations in the query monitor very frequently. Is there any general recommendation that community can suggest here?
If I understand the question correctly,
In typical deployments, all nodes hosting one copy of an index is uncommon. You can create index copies based on failover zones (like rack zones) or your availability requirements. No need to create one copy on each node.
Having said that, Couchbase index replicas are implemented as master-master replication architecture. And all the replicas (masters) will be built independently, and asynchronously. So, insert or upsert performance is not affected by number of indexes (or even replicas). So, having separate indexes (with different names) compared to having index replicas is equivalent from the perspective of the performance.
But for results of insert/upsert to be available via query (n1ql), Couchbase cluster - as a whole, will have to do repetitive work (both in case of index copy or index replicas). But that repetitive work happens on different nodes in the cluster. Please look at the documentation.
Index replicas makes manageability of index simpler - by allowing users to change number of replicas, dropping a bad replica etc.
Hope this helps.
Amit, thank you for the insight into how index replicas work. If I understand correctly, couchbase CE doesn’t support index replicas. I used both {"num_replica": 2}
and WITH {"nodes":["node1:8091", "node2:8091", "node3:8091"]}
. I get the following error.
"msg": "GSI CreateIndex() - cause: Index Replica not supported in non-Enterprise Edition\n",
The question was in that context. What are the best practices to distribute indexes in Community Edition?
I gather from your second paragraph, the having index replicas or indexes with different names but same predicate on different nodes will have no impact on the update/insert performance. So, I should be able to resolve the index replication problem by creating different indexes on nodes.
You said it correctly. There won’t be any performance impact on insert/update performance because of indexes with different names but with same predicate.