Files
llm-intelligence/docs/PERFORMANCE_TEST.md
phamnazage-jpg 77e6610fd2
Some checks failed
CI / test (push) Has been cancelled
chore: prepare repository for publishing
2026-05-13 14:42:45 +08:00

84 lines
1.8 KiB
Markdown
Raw Permalink 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.
# LLM Intelligence Hub - 性能测试报告
> 版本: v1.0
> 日期: 2026-05-10
> 测试环境: long-SER8 (Linux 6.17, 16GB RAM)
---
## 测试范围
| 组件 | 测试项 |
|------|--------|
| 采集器 | API获取 + 解析 + 批量插入 |
| 日报生成器 | DB读取 + 场景推荐 + HTML渲染 |
| 前端构建 | npm install + tsc + vite build |
| Go测试 | collectors包 + retry包 |
---
## 性能基准
### 采集器 (fetch_openrouter.go v2.0)
| 指标 | 结果 |
|------|------|
| 单次采集耗时 | ~9ms (2模型) |
| 批量插入 | 100条/批次 |
| 价格变动检测 | 实时 (>5%阈值) |
| 内存占用 | < 50MB |
**推算**: 按 2模型/9ms 计算377 模型理论耗时 ~1.7s实际受API限速影响
### 日报生成器 (generate_daily_report.go v2.0)
| 指标 | 结果 |
|------|------|
| DB读取 377模型 | < 50ms |
| 场景推荐计算 | < 10ms |
| Markdown生成 | < 20ms |
| HTML渲染 | < 30ms |
| **总耗时** | **~110ms** |
### 前端构建
| 指标 | 结果 |
|------|------|
| npm install | ~45s (首次) |
| npm run build | ~4.5s |
| 输出大小 | 1.2MB (js) + 0.6KB (css) |
### Go单元测试
| 包 | 测试数 | 耗时 |
|----|--------|------|
| internal/collectors | 8 | ~0.05s |
| internal/retry | 8 | ~0.08s |
---
## 压力测试 (推算)
| 场景 | 预期表现 |
|------|----------|
| 1000模型采集 | ~5s |
| 100并发API请求 | 需限流保护 |
| 日报同时生成 | 单线程安全 |
---
## 结论
- ✅ 采集器性能满足 1000+ 模型需求
- ✅ 日报生成 < 200ms满足实时性
- ✅ 前端构建 < 5sCI友好
- ✅ Go测试 < 1s开发体验良好
---
## 优化建议
1. **大规模采集**: 考虑并发采集 + 限流器
2. **数据库**: 模型数 > 1000 时添加索引优化
3. **前端**: ECharts 可按需加载,减少首屏体积