gongxiangp2/docs/AI生图平台第一层桶缓存落地方案.md
chenpei 7326e273e1 fix: harden media upload and release safety
Protect upload cleanup and atomic completion paths, add durable media worker leases and brand asset validation, and introduce verified migration/bootstrap/deployment gates.
2026-08-12 18:04:08 +08:00

128 lines
4.2 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.

# AI 生图平台第一层桶缓存落地方案
> 更新时间:2026-07-09
> 当前正式资源域名:`https://s3.jiansun.vip`
> 当前正式入口机:`218.93.9.38`
> 历史入口机:`103.118.245.6`(不再作为当前默认排障入口)
> 已停用缓存入口机:`180.97.215.57`
> 当前桶本体:`192.168.58.20:9000`
## 1. 结论
AI 生图平台不再沿用“整个 `/uploads/` 都进长缓存”的口径,也不再使用 `180.97.215.57` 这台缓存入口机。当前保留更稳定的新前缀分流:
- 正式展示图前缀:`/gongxiangpan/public-display/`
- 首期只保证“新生成展示图”走新前缀
- 历史 `/uploads/` 对象继续可访问,但不再作为默认展示缓存路径
## 2. 当前正式链路
### 2.1 没命中缓存时
```text
AI 生图平台
-> https://s3.jiansun.vip/gongxiangpan/public-display/...
-> 218.93.9.38
-> nginx
-> 127.0.0.1:2323
-> FRP
-> 192.168.58.20:9000
-> 返回图片
```
### 2.2 关于旧缓存入口
- `180.97.215.57` 已停用,不再作为 `s3.jiansun.vip` 的正式链路。
- `180.97.221.140` 是历史入口,不再作为当前默认排障入口。
- 旧的 `180G` nginx 磁盘缓存方案只保留历史记录,不再作为联调或排障门禁。
## 3. 为什么改成新前缀
旧方案的问题是:
- `/uploads/` 里既有图片,也有混合对象
- 规则边界不清,容易把缓存口径和历史兼容混在一起
- 很难长期保证“只缓存该缓存的东西”
新前缀方案的好处是:
- 展示图和混合区彻底分开
- 展示资源规则稳定,先按前缀收口,减少历史混合路径干扰
- 对外链路、代码写入和入口层回源能保持一致
## 4. 首期范围
首期纳入 `public-display` 的对象:
- 白底图预览
- 任务-详情主图 / SKU 图 / 详情图预览
- AI 生图平台最终展示图
- 其它明确属于页面展示的成品图
首期不做:
- 历史 `/uploads/` 批量迁移
- 大源文件缓存
- 视频源文件缓存
- 压缩包缓存
## 5. 当前展示资源策略
- 展示图对象优先写入 `/gongxiangpan/public-display/`
- `uploads` 保留为历史混合区,不作为默认展示资源路径
- 源文件 / ZIP / PSD / 视频源等下载型对象继续落在生产机独立 ZFS uploads 数据集:`/mnt/PoolOne/youyidian-uploads`
- `s3.1080p.hk/jsxiangche` 只保留极少数老素材兼容,不作为新素材或新预览写入目标
- 当前不再以 `X-Cache-Status` 作为正式验证标准
- 当前优先验证 `s3.jiansun.vip -> 218.93.9.38 -> 192.168.58.20:9000` 是否可达
## 6. 历史验证结果
### 6.1 `public-display` 命中缓存
以下结果属于 `180.97.215.57` 缓存方案历史记录,当前不再作为正式门禁。测试对象:
- `https://s3.jiansun.vip/gongxiangpan/public-display/network-check/20260325-cache-test.png`
实测结果:
- 第一次:`X-Cache-Status: MISS`
- 第二次:`X-Cache-Status: HIT`
边界验证:
- `https://s3.jiansun.vip/gongxiangpan/public-display/network-check/limit-exact-10m-1774428109043.png`
- `Content-Length: 10485760`
- 第一次:`MISS`
- 第二次:`HIT`
### 6.2 大文件不进入这层缓存
测试对象:
- `https://s3.jiansun.vip/gongxiangpan/由壹点AI/video-preview-720p-9b1c86b6-0249-44ae-98fe-e480f5f5ac2c-1767153103562.mp4`
- `https://s3.jiansun.vip/gongxiangpan/public-display/network-check/limit-over-10m-1774428109043.png`
实测结果:
- `X-Cache-Status: BYPASS`
- `limit-over-10m-1774428109043.png`:第一次 `BYPASS`,第二次 `BYPASS`
## 7. 对接口径
AI 生图平台后续如果要对接正式展示图,统一按下面这个口径:
- 域名:`https://s3.jiansun.vip`
- 路径:`/gongxiangpan/public-display/...`
不要再把下面这些当默认入口:
- `https://s3.yydd.ai`
- `https://s3.jiansun.vip/gongxiangpan/uploads/...`
## 8. 一句话版本
AI 生图平台现在的第一层桶缓存口径是:
**新生成的展示型图片统一写到 `s3.jiansun.vip` 的 `/gongxiangpan/public-display/`,当前正式入口收敛到 `218.93.9.38`;`180.97.215.57` 缓存入口已停用,`103.118.245.6` 不再作为当前默认排障入口,历史 `/uploads/` 继续可访问,但不再作为默认展示路径。**