Microsoft Certified: Azure Developer Associate (AZ-204)Monitor, troubleshoot, and optimize Azure solutionsEasy
A development team is building a new e-commerce platform that uses Azure Cosmos DB as its primary data store. They anticipate high read volumes for product catalog data, which changes infrequently. To improve performance and reduce Cosmos DB costs, they decide to implement caching. Which caching strategy is most appropriate for this scenario?
- AWrite-through caching
- BContent Delivery Network (CDN)
- CWrite-behind caching
- DCache-aside (lazy loading)
Show answer & explanationAnswer & explanation
Correct answer: D. Cache-aside (lazy loading)
Cache-aside, also known as lazy loading, is ideal when data is read frequently but updated infrequently. Data is only loaded into the cache when requested and not found, reducing unnecessary cache population.
Why the other options are wrong
- A. Write-through caching updates the cache synchronously with the data store, which is not optimal for infrequently changing data and high read volumes.
- B. A CDN is used for caching static web content closer to users, not for caching dynamic database queries or application data.
- C. Write-behind caching updates the cache immediately and asynchronously updates the data store, which is not primarily focused on read performance optimization for static data.
Cache-aside (Lazy Loading)
A caching strategy where the application is responsible for managing data loading into and out of the cache. Data is only loaded into the cache when it's requested and not found.
- Application manages cache population.
- Best for read-heavy workloads with infrequently updated data.
- Reduces unnecessary cache writes.
Memory trick: Read-heavy data, lazy load it, so you don't bog down.