Hello MongoDB community!
Environment settings:
5 shards M60
3 nodes for each shard
Mongo 5.0
I’m working on a project where we’ve observed significant traffic in our database operations. Currently, we handle a total of 48,842 operations per second, with approximately 52.5% of these operations being reads and 47.5% being write operations.
Here are some key metrics from the latest operations of the week:
- Read operations per second: 25,685
query
: 2,194getmore
: 23,491
- Write operations per second: 23,157
update
: 7,004insert
: 1,858cmd
: 14,295
We are exploring the possibility of optimizing performance and load distribution in our MongoDB environment, and we have considered changing the read preference to ‘secondaryPreferred.’
Objective:
We want to calculate how much we can reduce CPU usage by moving a portion of read operations to secondary nodes using the secondaryPreferred read preference.
Questions:
- Has anyone implemented this configuration before and could share their experience?
- How can I calculate the estimated reduction in CPU usage by switching to
readPreference: 'secondaryPreferred'
? - Are there specific factors I should consider when making this change in a production environment?
We appreciate any advice, past experiences, or information that can help us make an informed decision. Thank you in advance for your collaboration and expertise!