opensearch-project / OpenSearch

🔎 Open source distributed and RESTful search engine.
https://opensearch.org/docs/latest/opensearch/index/
Apache License 2.0
9.48k stars 1.74k forks source link

Optimise the cluster manager writeTo/readFrom transport call #14942

Open Arpit-Bandejiya opened 1 month ago

Arpit-Bandejiya commented 1 month ago

Describe the bug

image

Currently good chunk of master CPU is going in TransportClusterManagerNodeAction where we are ser/deser the discovery nodes. We could caches these values and optimise these calls.

Related component

Cluster Manager

To Reproduce

Create an cluster with large number of nodes and do CPU profiling of the active master.

Expected behavior

We could have leveraged the stored discovery nodes in the cluster state to populate the discoveryNodes.

Additional Details

Plugins Please list all plugins currently enabled.

Screenshots If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

Additional context Add any other context about the problem here.

Arpit-Bandejiya commented 1 month ago

We are writing the discoveryNodes here which is becoming the bottleneck: https://github.com/opensearch-project/OpenSearch/blob/09bacee5fc85676e97bee6b4ad87dec35c6aa8cc/server/src/main/java/org/opensearch/cluster/ClusterState.java#L784