I setup a sharded cluster and mainly interact via mongos with go-mongo-driver. There are 6 query routers:
I format connect string according to the order above. It seems a:27016 consumes more CPU than other mongos instance (about 50%), which means a:27016 takes more requests and it’s imbalancing.
I read the server selection algorithm and everything is great. This is my understanding:
When server kind is Mongos
- ReadPrefSelector returns all candidates.
- LatencySelector selects according to latency, but I think most cases it returns all candidates as well.
- Topology.SelectServer picks 2 servers from candidates randomly, and then picks the less operation count one
Do I misconfigure or is there any bug leads to imbalancing?