Recall & Review
beginner
What does reading from secondaries in MongoDB mean?
It means querying data from secondary replica set members instead of the primary, which can reduce load on the primary and improve read scalability.
Click to reveal answer
beginner
What is a main trade-off when reading from secondaries?
You might get stale data because secondaries replicate changes asynchronously and can lag behind the primary.
Click to reveal answer
intermediate
How does reading from secondaries affect consistency?
It can reduce consistency guarantees because the data on secondaries may not reflect the most recent writes made to the primary.
Click to reveal answer
intermediate
Why might an application choose to read from secondaries despite potential stale data?
To improve read throughput and reduce latency by distributing read load, especially for read-heavy workloads.
Click to reveal answer
advanced
What is a common strategy to minimize stale reads when reading from secondaries?
Use read preferences like 'secondaryPreferred' with a maxStalenessSeconds setting to limit how stale the data can be.
Click to reveal answer
What is a potential downside of reading from MongoDB secondaries?
✗ Incorrect
Secondaries replicate asynchronously, so data can be slightly behind the primary.
Which read preference allows reading from secondaries but falls back to primary if no secondaries are available?
✗ Incorrect
'secondaryPreferred' reads from secondaries if possible, otherwise from primary.
How can you limit how stale data can be when reading from secondaries?
✗ Incorrect
maxStalenessSeconds restricts how old the data on secondaries can be for reads.
Why might an application prefer reading from the primary over secondaries?
✗ Incorrect
Primary always has the latest data, so reading from it ensures strong consistency.
Which scenario benefits most from reading from secondaries?
✗ Incorrect
Reading from secondaries improves read throughput but may return slightly stale data.
Explain the trade-offs of reading from secondaries in MongoDB replica sets.
Think about what happens when data is copied asynchronously.
You got /4 concepts.
Describe strategies to reduce stale reads when using secondary reads in MongoDB.
Consider configuration options that control how fresh the data must be.
You got /4 concepts.