Engineering Decisions · Middle · Question 2 of 14

After a transfer, the user opens their balance. The number must be exact, while the rest of the banking app reads from replicas. Where does this read go?

Show the answer

Correct answer: To the primary, with no cache in between

Explanation

Money shown right after a write must reflect that write, and the primary is the one place that guarantees it. A replica fits lists and history, where a second of lag is harmless. A cache with invalidation fits frequently read data with rare writes, but a missed invalidation here would show a wrong balance, which costs more than the extra read.

Further reading

Problem with a question

Engineering Decisions · Middle · question 2

Test yourself

Take the Engineering Decisions · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz