200-901 · Question #483
A developer creates a REST API that runs on a load balancer for clients to query information about stocks. The data in the back-end database is updated every 15 minutes, but clients are polling the…
The correct answer is B. Use of Cache-Control headers and max-age validation is not enforced. Enforcing Cache-Control headers with an appropriate max-age value satisfies the REST cacheability constraint and reduces repeated database queries without client changes.
Question
A developer creates a REST API that runs on a load balancer for clients to query information about stocks. The data in the back-end database is updated every 15 minutes, but clients are polling the API every 2 minutes. The developer needs to reduce the load on the database without making changes to the client side. Which constraint must the engineer address?
Options
- AThe load balancer is not configured to use memcached as the primary back end.
- BUse of Cache-Control headers and max-age validation is not enforced.
- CRequest throttling on the load balancer database is not enabled.
- DDynamic IP deny listing, which allows requests every 15 minutes, is not configured.
How the community answered
(33 responses)- A15% (5)
- B70% (23)
- C9% (3)
- D6% (2)
Why each option
Enforcing Cache-Control headers with an appropriate max-age value satisfies the REST cacheability constraint and reduces repeated database queries without client changes.
Memcached is a valid server-side caching technology, but the REST architectural constraint violated here is cacheability enforced through HTTP headers, not the choice of a specific caching backend technology.
REST's cacheability constraint requires that API responses include Cache-Control headers so that intermediate proxies or the load balancer can serve cached responses. Setting 'max-age=900' (15 minutes) instructs the cache to serve previously fetched responses for 15 minutes, meaning the 2-minute client polling interval results in only one actual database call per 15-minute window instead of seven, reducing load without any client-side modification.
Request throttling limits the rate at which clients can make requests, but does not cache responses or prevent valid in-limit requests from hitting the database, so it does not solve the repeated database query problem.
IP deny listing blocks client access based on network address and is a security control, not a REST caching mechanism; it would deny legitimate clients rather than serve cached data.
Concept tested: REST cacheability constraint using Cache-Control max-age headers
Source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
Topics
Community Discussion
No community discussion yet for this question.