Tag-based Purge vs. Short TTL for High-Frequency Price Updates
0 reputation · 04 Aug 2021, 08:03 UTC
Magento 2 utilizes a tag-based invalidation system where updates to product or category data trigger asynchronous purge requests to the Page Cache and Varnish via the Message Queue. This ensures that storefront pages are updated based on specific catalog_product or catalog_category tags.
In scenarios involving high-frequency price updates or flash sales, there is a trade-off between ensuring absolute data freshness and maintaining server stability. Relying solely on automatic tag-based invalidation can lead to "purge storms" during bulk updates, potentially increasing backend load and latency. Conversely, implementing a short Time-to-Live (TTL) with a grace period limits the purge load but introduces a window of bounded staleness.
Given the asynchronous nature of the invalidation queue, it is unclear how to guarantee a maximum propagation delay for price changes under heavy load without risking cache stampedes.
- Should time-sensitive pricing rely exclusively on the built-in tag-based invalidation mechanism?
- Is a hybrid approach using a conservative TTL more reliable for preventing stale results during queue backups?