<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>High Availability on Zhuifeng Notes</title><link>https://4f0a9a3b.wangpeng.pages.dev/en/tags/high-availability/</link><description>Recent content in High Availability on Zhuifeng Notes</description><generator>Hugo</generator><language>en</language><lastBuildDate>Tue, 25 Aug 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://4f0a9a3b.wangpeng.pages.dev/en/tags/high-availability/index.xml" rel="self" type="application/rss+xml"/><item><title>Redis Cache Design</title><link>https://4f0a9a3b.wangpeng.pages.dev/en/tech/redis/cache-design/</link><pubDate>Tue, 25 Aug 2026 00:00:00 +0000</pubDate><guid>https://4f0a9a3b.wangpeng.pages.dev/en/tech/redis/cache-design/</guid><description>&lt;p&gt;Introducing a cache dramatically reduces database pressure, but poor design introduces the classic problems of penetration, breakdown and avalanche. We break down the causes and countermeasures below.&lt;/p&gt;&#10;&lt;h2 id="the-three-classic-problems"&gt;The Three Classic Problems&#10;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Cache penetration&lt;/strong&gt;: querying data that does not exist, so neither cache nor DB returns it and every request hits the DB. Mitigate with caching empty values (short TTL) or a Bloom filter to block illegal keys.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Cache breakdown&lt;/strong&gt;: the moment a hot key expires, many concurrent requests all fall back to the DB at once. Mitigate with a mutex (only one thread rebuilds), logical expiration (async refresh), or never-expire hot keys.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Cache avalanche&lt;/strong&gt;: a large number of keys expire simultaneously, or Redis becomes entirely unavailable, overwhelming the DB. Mitigate with random jitter on expiration times, multi-level caching, and Redis high availability (Sentinel/Cluster).&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="cache-aside-and-consistency"&gt;Cache-Aside and Consistency&#10;&lt;/h2&gt;&#10;&lt;p&gt;The most common pattern is &lt;strong&gt;Cache-Aside (旁路缓存)&lt;/strong&gt;:&lt;/p&gt;</description></item></channel></rss>