0
0
MongoDBquery~5 mins

Read from secondaries trade-offs in MongoDB - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AData might be outdated due to replication lag
BPrimary server load increases
CWrites become slower
DSecondaries cannot serve reads
Which read preference allows reading from secondaries but falls back to primary if no secondaries are available?
Aprimary
Bsecondary
CsecondaryPreferred
Dnearest
How can you limit how stale data can be when reading from secondaries?
ADisable journaling
BUse write concern majority
CIncrease primary election timeout
DSet maxStalenessSeconds in read preference
Why might an application prefer reading from the primary over secondaries?
ATo increase read scalability
BTo get the most up-to-date data
CTo reduce primary load
DTo avoid replication lag
Which scenario benefits most from reading from secondaries?
ARead-heavy workloads with tolerance for slightly stale data
BSingle server deployments
CApplications requiring strict consistency
DWrite-heavy workloads
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.