Google Professional Cloud Developer Question 5
Select 3Google Cloud PlatformYou are designing an API for a high-traffic e-commerce application that handles thousands of requests per second. To ensure high performance, you decide to implement caching for frequently accessed product data. Which of the following considerations are important when designing the caching layer for this API?
- A
Use a distributed cache like Memorystore or Redis to handle high volumes of concurrent requests.
- B
Cache the entire database to ensure no database calls are made.
- C
Implement cache invalidation strategies to ensure data consistency.
- D
Use a client-side cache only to reduce server-side overhead.
- E
Consider time-to-live (TTL) settings to automatically expire stale data.
Show answer and explanation
Correct answers: A, C, E
Explanation
To design a high-performing API with caching, you should use a distributed caching system to handle scale and concurrency, implement cache invalidation strategies for data consistency, and set appropriate TTL values to automatically manage the lifecycle of cached data. These practices collectively ensure the caching layer is both efficient and reliable, which is crucial for high-traffic applications.
- A. Correct.
A distributed cache like Memorystore or Redis is highly scalable and effective for handling high volumes of requests, making it a suitable choice for high-performance applications.
- B. Incorrect.
Caching the entire database is not efficient or practical. It can lead to excessive memory usage and does not address specific high-frequency queries.
- C. Correct.
Cache invalidation strategies are critical to ensure that the cache does not serve stale or inconsistent data, maintaining the correctness of the application.
- D. Incorrect.
A client-side cache is not sufficient on its own for high-traffic applications, as it only benefits individual users and does not reduce server-side load for shared data.
- E. Correct.
Time-to-live (TTL) settings help ensure that cached data does not become outdated while also reducing the need for manual cache management.