API Design · Senior · Question 16 of 75
How do you design an API endpoint whose underlying query is expensive and popular?
- ✓Correct answer: Cache at the right layer (HTTP with ETags, CDN, application cache), paginate, precompute aggregates, and rate limit per client
- 2Run the query on every request
- 3Return everything in one response
Explanation
Also make sure clients can use conditional requests so unchanged data costs almost nothing.