Avinash Vundyala
Avinash Vundyala

Reputation: 95

Queries on Mongo Secondary are not equally distributed

I have a MongoDB cluster setup with one primary and 2 Secondaries in a single shard setup. Every night we have a high load but one day and most of the read APIs have a SECONDARY_PREFERRED read preference.

But the load not balanced as shown below: enter image description here

X-Axis -> time Y-Axis -> number of queries

Green -> Secondary one Yellow -> Secondary two

And the CPU of the corresponding machines enter image description here

X-Axis -> time Y-Axis -> % of CPU IDLE

Green -> Secondary one Yellow -> Secondary two

We are using Mongo Java Driver Why would the query be distributed unevenly?

Upvotes: 0

Views: 111

Answers (1)

D. SM
D. SM

Reputation: 14510

The graphs show that load on the machines (i.e. CPU usage) is balanced most of the time.

Drivers attempt to choose less loaded nodes as described here.

There is no requirement either on server side or on driver side that CPU usage on all secondaries is exactly identical at all times.

Every night we have a high load but one day and most of the read APIs have a SECONDARY_PREFERRED read preference.

This sentence doesn't make any sense. What does night load have to do with read apis during day?

Upvotes: 1

Related Questions