Why does most of the traffic go to the primary MongoDB node?
In a MongoDB cluster:
- all write traffic has to go to the primary node
- it is responsible for dispatching to the other nodes
- by default, most of the read traffic also goes to the primary node
- this is the default and safest option
You can alter that behavior by using Read and Write concerns
Allows you to define how you want writes to be handled by the MongoDB cluster. The write operation will always be done first on the Primary node, but then the question is to know if you also wait for the acknowledgment on the secondary (none, all, majority ...). This setting allows you to define if you want to favor performance over consistency.
Allow you to define if you want to read operations to be dispatched to secondaries or not. Reading from secondaries may result is some inconsistencies, depending on how you configured write concerns. Here again, this settings allows you to define if you want to favor performance over consistency.
You can define Read and Write concern as part of the connection string.