Read preference relevancy when combining with read concern

does it really matter to chose read preference with read concern majority?

Let’s say there is 3 nodes
A, primary
B & C secondary

If I need the data to be acknowledged by majority,
It means that there is no difference whether the read preference is primary or secondary right?

Not when the secondary is in a data centre geographically closer (or better served network wise) to where you read from.

let’s say the client is connected to B, (read preference secondary)

then B will know the distance (network cost) of B to C compared to B to A? how technically it measures that?

Hi @Altiano_Gerung

The network latency as determined by the driver is what is used to calculate the ‘distance’

I’d suggest looking at the heuristics/rules used for the read preferences Server Selection Algorithm — MongoDB Manual as these may help understand how this is calculated.

The latency window is calculated by the Driver using lowest average round-trip-time on the network between members. This latency window which is the average round trip time of the closest server plus the the localThresholdMS [1] gives the window of latency used to select the nearest members.

This process is used for the read preference nearest but it is calculated on a continual basis as part of the background maintenance tasks related to replication between members.

Hope this helps clarify your question.

Kindest regards,
Eoin

1 Like