mirror of
https://github.com/CyC2018/Interview-Notebook.git
synced 2026-10-30 07:33:45 +00:00
Update 缓存.md
正文中“本机回环”的说法改为客户端与 Redis 在同一台机器上;布隆过滤器与 LRU 的配图改由脚本生成。
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 100 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
+1
-1
@@ -67,7 +67,7 @@
|
||||
|
||||
<div align="center"> <img src="pics/multilevel-cache.png" width="760px"/> </div><br>
|
||||
|
||||
Caffeine 读取一次约 21 纳秒;用单个连接逐条向 Redis 发送 GET,每次约 68 微秒,相差三千多倍(JDK 21、Redis 7.4 实测,见[附录 A1](#a1-本地缓存与-redis-的读取耗时)),这还只是本机回环,跨机器访问还要加上网络往返。热点数据放在本地缓存中,既省去了网络开销,也不会让请求集中到存放这个热点键的 Redis 节点上。
|
||||
Caffeine 读取一次约 21 纳秒;用单个连接逐条向 Redis 发送 GET,每次约 68 微秒,相差三千多倍(JDK 21、Redis 7.4 实测,见[附录 A1](#a1-本地缓存与-redis-的读取耗时)),这还只是客户端与 Redis 在同一台机器上的结果,跨机器访问还要加上网络往返。热点数据放在本地缓存中,既省去了网络开销,也不会让请求集中到存放这个热点键的 Redis 节点上。
|
||||
|
||||
本地缓存在每个实例中各存一份,难点在于数据更新后怎样让所有实例失效:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user