
Ultimate access to all questions.
Your weather application retrieves the current temperature from a database every 15 minutes. The frontend, which is powered by Google App Engine, serves millions of users. In the event of a database failure, how should you design the frontend to respond effectively?
A
Issue a command to restart the database servers.
B
Retry the query with exponential backoff, up to a cap of 15 minutes.
C
Retry the query every second until it comes back online to minimize staleness of data.
D
Reduce the query frequency to once every hour until the database comes back online.
Explanation:
The correct answer is B. Retry the query with exponential backoff, up to a cap of 15 minutes. Exponential backoff is a commonly used technique to handle temporary failures, such as a database server becoming temporarily unavailable. This approach retries the query, initially with a short delay and then with increasingly longer intervals between retries. Setting a cap of 15 minutes ensures that you don't excessively burden your system with constant retries. The other options are less effective: Option A is not suitable for a frontend component, Option C can lead to excessive load on the server, and Option D would result in significantly stale data and a poor user experience.