Read From Secondary

I remember hearing that when reading data, MongoDB vendor does not recommend reading from secondary.
Can I know the reason why I didn’t recommend it and any problems or performance issues that can occur when I read it from secondary?

One issue when reading from a secondary is stale data, which means that the data on the secondary is not the most recent data. This happens because it is replicating from the Primary, so if there is a write or update on the primary and a read happens on the secondary before the data has replicated you are reading “old” data.

If read preference is set to secondary it will only read from a secondary. So if there are no secondary available then this will cause an error.

Reading from secondary can help take some load off of your primary but if your application needs to have the most up-to-date information it is best to leave the read preference as primary.

For more information on read preferences you can look here

2 Likes

First of all, thank you for your kind and quick response.

I understand that you don’t recommend reading secondary in certain circumstances because of old data.
Except for this case, don’t you recommend to perform secondary read operations in common cases?

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.