Files
myWiki/concepts/active-cache-warmup.md
2026-06-01 10:46:01 +08:00

40 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "Active Cache Warm-up (主动缓存预热)"
created: 2026-05-29
updated: 2026-05-29
type: concept
tags: ["distributed-systems", "caching", "optimization", "LLM"]
sources: ["https://mp.weixin.qq.com/s/MUWV7eug14bktUMlqsxfQw"]
---
# Active Cache Warm-up (主动缓存预热)
**Active Cache Warm-up** 是 [[distributed-prompt-caching]] 中的预测性机制:在需要跨节点协作之前,通过提前向目标节点发送特殊的预热请求,使其 LLM 前缀缓存提前进入 "HOT" 状态。核心实现是 [[shadow-calling]]。
## 预热流水线三步法
### 第一步:前缀拓扑合成
从主控节点拉取因子链的最新上下文树,过滤掉尾部高频变动的实时行情,提取静态系统提示词、工具集和历史评估纪要(占体积 90%+),拼接成预备 Token 流。
### 第二步:异步影子调用([[shadow-calling]]
向目标节点发送特殊的影子请求:
- `max_tokens=1`:只需消化前缀,不需生成
- 显式启用 `cache_control`:强制打缓存标记
- 零输出下游拦截:返回结果直接丢弃
### 第三步:状态置标与就绪通知
影子调用成功后Redis 中 status 改为 "HOT"。真实信号爆发时,该节点的 API 响应延迟降至百毫秒级。
## 预测触发机制
在量化系统中,预热由可预测事件触发:
- 盘面时间逼近风险控制窗口
- 核心标的波动率超过阈值
- 高频队列检测到临界信号
## 相关
- [[shadow-calling]] — 预热的核心调用机制
- [[distributed-prompt-caching]] — 分布式缓存体系
- [[cache-cold-start]] — 预热要解决的核心问题