C100DBA · Question #109
What read preference should your application use if you want to read from the primary under normal circumstances but allow reads from secondaries when a primary is unavailable?
The correct answer is E. primaryPreferred. primaryPreferred (E) is correct because it does exactly what the question describes: it routes reads to the primary by default, but automatically falls back to a secondary replica if the primary is unavailable - giving you both consistency and availability. Why the distractors…
Question
What read preference should your application use if you want to read from the primary under normal circumstances but allow reads from secondaries when a primary is unavailable?
Options
- AsecondaryPreferred
- BSecondary
- Cnearest
- Dprimary
- EprimaryPreferred
How the community answered
(28 responses)- A4% (1)
- B7% (2)
- E89% (25)
Explanation
primaryPreferred (E) is correct because it does exactly what the question describes: it routes reads to the primary by default, but automatically falls back to a secondary replica if the primary is unavailable - giving you both consistency and availability.
Why the distractors are wrong:
- A (secondaryPreferred) is the inverse: it prefers secondaries and only falls back to the primary, not the other way around.
- B (secondary) forces reads to secondaries only and will error if no secondary is available - no primary fallback at all.
- C (nearest) routes to whichever member has the lowest network latency, ignoring primary/secondary preference entirely.
- D (primary) is strict primary-only - if the primary is down, reads fail rather than falling back to a secondary.
Memory tip: Think of the suffix "Preferred" as meaning "try this first, but use the other if needed." primaryPreferred = try primary first; secondaryPreferred = try secondary first. The ones without "Preferred" (primary, secondary) are strict and will not fall back.
Topics
Community Discussion
No community discussion yet for this question.