Why reading from secondaries does not affect read-performance, when you have a high write-worlload?

“Under heavy write load you should scale your read throughput by reading from secondaries”

Why the above statement is “false”?

Let’s imaging the following situation:
We have 5 machines: P-S-S-S-S.
The primary is highly loaded with write-requests, which means, that all 3 members are highly (and equally) loaded (because of the replication).

Let’s quantify all the workload as: 200X writes and 800Y reads.

If all the read-requests go to the primary - primary will have to do all the work: 200X + 800Y.
But, if we distribute read operations across secondaries, each machine will have the following workload:
P = 200X
each S = 200X + (800/4) = 200X + 200Y.

As read operations are spread between secondaries, each node becomes less overloaded so:

  • it potentially can handle move operations
  • distributed requests can be executed in parallel on each machine and deliver the result faster (reads are not queued in long queues).

Please, help me clarify this: why the last answer is “false”?

I do not think that having 4 times more read than write qualify as a high-write workload.

ah, I see what you mean, “a high-write workload” means that write/read ration is much more than 1.
what DBA can do it this situation, except using sharding?

Hi @biryukvy,

Great question! We have a great community forum where you can have an in-depth conversation about specific use cases and interesting problems that you get to solve using MongoDB. I would highly recommend posting your question there for a more involved discussion.

Kind Regards,
Sonali