SAA-C03 Question 110
Single answerA company operates a high-traffic e-commerce website where product details and customer reviews are accessed frequently. To improve performance and reduce the load on their backend database, the company decides to implement caching. Which strategy would be the most appropriate to ensure frequently accessed data is cached while ensuring updates to product details are reflected quickly in the cache?
- A
Write-through caching
- B
Lazy loading (cache-aside)
- C
Read-through caching
- D
Write-behind caching
Show answer and explanation
Correct answer: B
Explanation
Lazy loading (cache-aside) is the most appropriate strategy for this scenario because it allows the cache to store only frequently accessed data, reducing unnecessary usage of cache memory. Additionally, it gives control over cache invalidation and refresh mechanisms, ensuring that updates to product details are quickly reflected in the cache. This makes it ideal for the described read-heavy workload where data freshness is a priority.
- A. Incorrect.
Write-through caching ensures data is written to the cache and the database simultaneously. However, it is less suitable for read-heavy workloads like the one described, as it primarily focuses on ensuring consistency during writes.
- B. Correct.
Lazy loading (cache-aside) is ideal for read-heavy workloads where the cache only loads data when it is requested. This strategy allows frequently accessed data to be cached while ensuring updates to product details are reflected in the cache by invalidating or refreshing outdated entries.
- C. Incorrect.
Read-through caching automatically fetches data from the backend and places it in the cache upon a cache miss. While this may appear suitable, it depends on a specialized caching layer, which may not align with the described need for flexibility in handling cache invalidation during updates.
- D. Incorrect.
Write-behind caching delays writing data to the backend database to improve write performance. This strategy is unsuitable for the scenario, as it focuses on write-heavy workloads rather than read-heavy workloads and quick data updates.