There are few areas you can adjust which will impact your system performance with Couchbase and Elasticsearch:
Disable Fields from Indexing.
When any search engine has to index large blocks of data,
the process is more CPU intensive than smaller blocks of
data. So if you have objects with large amounts of text that
are not important for search results, you can provide a
custom mapping and omit those fields from indexing using the
setting enabled. For more detailed
information, see
Elastic
Search Guide, Object Type.
Add Elasticsearch Nodes.
If your Couchbase Server cluster experiences a backlog of items in the replication queue, you may want to consider adding additional Elasticsearch nodes. This should increase how quickly items can be indexed by the search engine.
Adjusting Concurrent Replication
If you are running your Couchbase cluster and Elasticsearch cluster on hardware with high-performance CPUs, you can increase this setting to improve replication speed between the two clusters. In the case of Elasticsearch, there are also scenarios where you may want to decrease this setting from the default so you do not overwhelm an Elasticsearch node. This is discussed below; for more information about this XDCR parameter, see Couchbase Server Manual, Changing Internal XDCR Settings.
One of the key parameters you can use to adjust XDCR
performance is xdcrMaxConcurrentReps;
this will increase or decrease the maximum concurrent
replication by a Couchbase node. The default number of
concurrent replications via XDCR is 32. For instance, if you
have five nodes in a Couchbase cluster and you have one
Elasticsearch node, Couchbase Server can generate up to 160
concurrent replications targeting the single Elasticsearch
node. Each replication can require multiple TCP connections
and both the concurrent replications and the number of
connections may overwhelm the Elasticsearch node. If this
does occur you can see the following types of errors in
Couchbase Web Console | XDCR | Ongoing XDCR section:
Error replicating vbucket 7: {badmatch, {error,all_nodes_failed, <<"Failed to grab remote bucket info from any of known nodes">>}} Error replicating vbucket 7: {error,{error,timeout}}}
This means that Couchbase Server cannot communicate with
Elasticsearch in the time that it expects. Couchbase Server
can recover from these types of errors and retry
replication, however your replication may take longer to
complete or operate with higher latency because the
operations must be later retried. If you encounter this
scenario, you should lower the default
xdcrMaxConcurrentReps setting to 8 or
less so that the total number of concurrent replications can
be handled by your Elasticsearch node. For more information
on changing this setting, see
Couchbase Server Manual, Changing Internal XDCR
Settings.