Caching vs real-time reads for stock availability on product pages
Product pages show "In stock / Only 3 left / Sold out". Reads peak at 30K/sec; stock changes about 200/sec, spiking during flash sales. Option A: cache availability in Redis with a short TTL, and invalidate on stock-change events from Kafka. Option B: read real time from the…