Đang mở hậu trường...
4 câu hỏi kỹ thuật chủ đề Caching, song ngữ Anh-Việt, có đáp án và giải thích.
Your team runs a product detail API backed by Redis with a 5-minute TTL per product key. Every evening when a flash sale starts, one very popular product's cache entry expires and within the same second thousands of concurrent requests all miss the cache and hit PostgreSQL, causing timeouts. The data may be a few seconds stale without harm. Which change best addresses this specific problem with the least complexity?
Your platform serves a product catalog to 40 microservices. Today each service keeps its own in-process Caffeine cache (TTL 5 min) of catalog entities. After a pricing bug shipped bad data, it took 5 minutes for all nodes to converge, and finance demanded sub-second correctness for price changes. Traffic is read-heavy (99:1), p99 latency budget is 30ms, and the catalog service cannot absorb full read traffic if caches are removed. As the engineering lead, which architectural direction best balances correctness, latency, and organizational cost?
A high-throughput analytics platform needs to handle frequent write spikes to aggregated metric counters. The engineering team is evaluating whether to implement a Write-Through or a Write-Behind (Write-Back) caching strategy. What is the primary architectural trade-off of choosing Write-Behind over Write-Through in this scenario?
An application uses an in-memory cache with a fixed capacity. When the cache becomes full, it should remove the item that has not been accessed for the longest time. Which eviction policy matches this requirement?