What could be causing this issue?
The cache is not being invalidated when the price of the item is changed.
The price of the item is being retrieved using a write-through ElastiCache cluster.
The DynamoDB table was provisioned with insufficient read capacity.
The DynamoDB table was provisioned with insufficient write capacity.
Explanations:
The cache is likely retaining the old price of the item after it has been updated in DynamoDB. If the application does not invalidate or update the cache entry after the price change, users will see stale data. This leads to discrepancies between the actual price in DynamoDB and the displayed price in the product listing.
A write-through caching strategy means that every write to the database is immediately reflected in the cache. If this strategy is properly implemented, the price change would be written to both DynamoDB and ElastiCache simultaneously, thus updating the price correctly. Therefore, this option does not explain the observed issue.
Insufficient read capacity on the DynamoDB table would result in throttling of read operations, but it would not directly cause the old price to persist in the cache. Users may experience delays or failures in reading the data, but if they retrieve the price after an update without a cache invalidation, it still reflects the latest data in DynamoDB, assuming reads succeed.
Insufficient write capacity would lead to throttling during updates, potentially causing updates to fail. However, if the updates do succeed but the cache is not updated accordingly, the old price would still be served. Thus, this does not explain why the price shown does not change despite a successful update.