20260601
This commit is contained in:
39
concepts/distributed-cache-routing.md
Normal file
39
concepts/distributed-cache-routing.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
title: "Distributed Cache Routing (分布式缓存路由)"
|
||||
created: 2026-05-29
|
||||
updated: 2026-05-29
|
||||
type: concept
|
||||
tags: ["distributed-systems", "redis", "routing", "caching"]
|
||||
sources: ["https://mp.weixin.qq.com/s/MUWV7eug14bktUMlqsxfQw"]
|
||||
---
|
||||
|
||||
# Distributed Cache Routing (分布式缓存路由)
|
||||
|
||||
**Distributed Cache Routing** 是 [[distributed-prompt-caching]] 中的状态路由层:基于 Redis 集群维护全局的 `Cache_Routing_Table`,使任何物理节点上的 Agent 实例都可以瞬间查询某会话前缀在哪台机器、哪个 LLM 服务商端处于 "HOT" 状态。
|
||||
|
||||
## 数据模型
|
||||
|
||||
```
|
||||
HSET cache:route:[Composite_SHA]
|
||||
node_ip "192.168.1.102"
|
||||
service_provider "ModelProvider_A"
|
||||
status "HOT"
|
||||
expire_time 1800
|
||||
```
|
||||
|
||||
## 查询流程
|
||||
|
||||
1. Agent 在本地对所需前缀进行 SHA-256 哈希 → 得到 Composite Key
|
||||
2. 通过 Redis `HGETALL cache:route:[Composite_SHA]` 瞬间检索
|
||||
3. 获取路由信息:该前缀在哪些物理节点、哪些服务商处于热态
|
||||
4. 据此决策:直接路由到热节点 / 触发 [[active-cache-warmup]]
|
||||
|
||||
## 核心价值
|
||||
|
||||
将逻辑上的会话状态与物理上的缓存生命周期**解耦映射**,使系统可以在异构模型服务商之上构建统一的缓存抽象。
|
||||
|
||||
## 相关
|
||||
|
||||
- [[global-context-hash-tree]] — 路由的主键来源
|
||||
- [[distributed-prompt-caching]] — 分布式缓存体系
|
||||
- [[active-cache-warmup]] — 路由到冷节点时的后续动作
|
||||
Reference in New Issue
Block a user