
Answer-first summary for fast verification
Answer: Set the memcache service level to dedicated. Create a key from the hash of the query, and return database values from memcache before issuing a query to Cloud SQL.
Option A is the best choice because it sets the memcache service level to dedicated, ensuring better performance and isolation compared to shared memcache. By creating a key from the hash of the query and retrieving database values from memcache before issuing a query to Cloud SQL, you effectively minimize the number of direct queries to Cloud SQL. This approach optimizes both performance and cost, as memcache can serve frequently requested data much faster than querying the Cloud SQL database every time.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
You are responsible for deploying a PHP application on Google App Engine Standard environment, which interacts with a Cloud SQL backend. The goal is to optimize the application's performance by minimizing the number of direct queries to Cloud SQL. What should you do to achieve this while leveraging caching mechanisms?
A
Set the memcache service level to dedicated. Create a key from the hash of the query, and return database values from memcache before issuing a query to Cloud SQL.
B
Set the memcache service level to dedicated. Create a cron task that runs every minute to populate the cache with keys containing query results.
C
Set the memcache service level to shared. Create a cron task that runs every minute to save all expected queries to a key called 'cached_queries'.
D
Set the memcache service level to shared. Create a key called 'cached_queries', and return database values from the key before using a query to Cloud SQL.