Engineering Decisions · Middle · Question 1 of 14
A news feed serves 1M users, may lag by a minute, and every call to the upstream API is paid. What's the main approach?
- 1A shared server cache with a TTL of about 60 seconds
- 2Fetching upstream for each user on every visit
- 3A per-user cache in each browser for 60 seconds
Show the answer
Correct answer: A shared server cache with a TTL of about 60 seconds
Explanation
One shared entry means all users cost a single upstream call per minute, and the minute of lag is allowed. A browser cache fits personal data and saves repeat visits, but with 1M users each one still pays for an upstream call. Fetching on every visit fits data that must be exact, like a balance, and here it would multiply the bill for no benefit.