Causes and troubleshooting of load unbalance of cluster instance:
Uneven data distribution: When data is unevenly distributed in a cluster, some nodes will process more data requests than other nodes. Run the sh.status() command to check the status of the sharded cluster and ensure that data is evenly distributed on the shard keys.
Index mismatching: The index settings may differ among nodes, resulting in less efficient querying on some nodes. Check whether the index settings for each node are consistent, especially if there is an index on the field to be queried.
Write bias: If all write requests are concentrated on one node, then that node may experience a higher load. In this case, the Write Concern parameter or Read Preference parameter can be used to distribute write requests.
Query mode: Certain query modes in the cluster may result in higher load on certain nodes. Run the db.currentOp() command to view the current query and analyze whether a query consumes a large amount of resources.
Data hotspots: Some data areas may be more active than others, resulting in data hotspots. Run the db.collection.stats() command to view the statistics of the collection and check whether there are any data hotspots.
Hardware performance: The hardware performance of nodes in the cluster may be uneven, resulting in poor processing capability of some nodes. Ensure that all nodes have similar hardware configurations and can meet load requirements.
Client connection: There may be too many connections on some nodes in the cluster, resulting in load unbalance. Run the db.serverStatus().connections command to check the number of connections per node.
Data migration: If data has been migrated or sharded again recently, load unbalance may occur. Make sure that data is migrated and evenly distributed.
Failure node: Some nodes may be faulty or unavailable, resulting in load unbalance. Check the cluster status and ensure that all nodes are running properly.