-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[🏠 首页](../_index.md) / architechture | ||
|
||
# architechture | ||
|
||
[缓存设计](cache-design.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[🏠 首页](../_index.md) / [architechture](_index.md) / 缓存设计 | ||
|
||
# 缓存设计 | ||
|
||
## 缓存穿透 | ||
|
||
缓存穿透是指查询一个在缓存层不存在的数据,请求会打到存储层。 | ||
|
||
解决办法: | ||
|
||
1. 缓存控对象; | ||
2. 布隆过滤器; | ||
|
||
## 缓存击穿 | ||
|
||
大批量缓存在同一时间失效,导致大量请求打到存储层造成数据存储服务压力过大。 | ||
|
||
解决办法: | ||
|
||
为缓存设置不同的过期时间。 | ||
|
||
## 缓存雪崩 | ||
|
||
缓存层服务失效,请求全部打到存储层。 | ||
|
||
解决办法: | ||
|
||
1. 缓存层高可用; | ||
2. 存储层采用限流、熔断或降级等隔离组件; | ||
3. 混沌工程,预演缓存层不可用,存储层处理能力。 | ||
|
||
## 热点缓存 | ||
|
||
热点数据,还未建立缓存或者缓存过期,同一时间巨大请求量并发打过来。 | ||
|
||
解决办法: | ||
|
||
- 使用互斥锁,只允许一个线程建立缓存。 |