一个专业的大语言模型性能测试平台,支持多种推理引擎和全面的性能指标分析。
🚀 快速开始: 查看 快速部署指南 了解如何一键部署到 Ubuntu 服务器
📚 完整文档: 访问 docs/ 查看所有文档
- 🚀 多引擎支持: vLLM、SGLang、LMDeploy等主流推理引擎
- 📊 性能测试: 吞吐量、延迟、并发度等全面性能指标
- 🔍 硬件监控: 自动收集GPU、CPU、内存等硬件信息
- 👥 用户管理: 基于角色的访问控制(管理员/普通用户)
- 🎨 主题切换: 支持亮色/暗色主题
- 📱 现代化UI: 响应式设计,优秀的用户体验
- 🔧 系统管理: Appauto版本管理和系统维护功能
- Python 3.10+
- FastAPI
- SQLModel + SQLite
- Alembic(数据库迁移)
- Uvicorn(ASGI服务器)
- React 18 + TypeScript
- Vite
- CSS Variables(主题系统)
git clone <repository-url>
cd perftest-platformcd llm-perf-platform
# 使用 uv(推荐,更快)
uv sync
source .venv/bin/activate
# 或使用传统 pip
# python3.10 -m venv .venv
# source .venv/bin/activate # Linux/Mac
# .venv\Scripts\activate # Windows
# pip install -e .
# 数据库会在首次启动时自动初始化,无需手动运行 alembic
# 启动后端服务
uvicorn llm_perf_platform.main:app --host 0.0.0.0 --port 8000 --reloadcd frontend
# 安装依赖
npm install
# (可选)配置开发环境 API 地址
# cp .env.example .env
# vi .env # 如果需要修改 API 地址
# 启动开发服务器
npm run dev访问 http://localhost:5173 即可使用平台。
注意:开发环境下,Vite 会自动代理 /api 请求到 http://localhost:8000。
默认管理员账号:
- 邮箱:
admin@example.com - 密码:
admin123
⚠️ 注意: 一键部署脚本正在开发中。请参考以下手动部署步骤。
在生产环境中,推荐使用 systemd + Nginx 的方式部署:
- Ubuntu 20.04+ / Debian 11+
- Python 3.10+
- Node.js 18+
- Nginx
- SQLite3
sudo apt-get update
sudo apt-get install -y \
python3.10 \
python3.10-venv \
python3.10-dev \
python3-pip \
nodejs \
npm \
nginx \
sqlite3 \
git \
build-essentialcd llm-perf-platform
# 方式 1: 使用 uv(推荐)
uv sync
source .venv/bin/activate
# 方式 2: 使用传统 pip
# python3.10 -m venv .venv
# source .venv/bin/activate
# pip install --upgrade pip
# pip install -e .
# 配置环境变量
cp .env.example .env
vi .env
# 数据库会在首次启动时自动初始化,无需手动运行 alembic
# 创建必要目录
mkdir -p logs resultscd frontend
# 安装依赖
npm install
# 构建生产版本
npm run build创建 /etc/systemd/system/llm-perf-backend.service:
[Unit]
Description=LLM Performance Test Platform - Backend API
After=network.target
[Service]
Type=simple
User=your-user
WorkingDirectory=/path/to/perftest-platform/llm-perf-platform
Environment="PATH=/path/to/perftest-platform/llm-perf-platform/.venv/bin"
ExecStart=/path/to/perftest-platform/llm-perf-platform/.venv/bin/uvicorn llm_perf_platform.main:app --host 0.0.0.0 --port 8000 --workers 4
Restart=always
RestartSec=10
StandardOutput=append:/path/to/perftest-platform/llm-perf-platform/logs/backend.log
StandardError=append:/path/to/perftest-platform/llm-perf-platform/logs/backend-error.log
[Install]
WantedBy=multi-user.target启动服务:
sudo systemctl daemon-reload
sudo systemctl enable llm-perf-backend
sudo systemctl start llm-perf-backend
sudo systemctl status llm-perf-backend创建 /etc/nginx/sites-available/llm-perf-platform:
server {
listen 80;
server_name your-domain.com;
# Frontend
location / {
root /path/to/perftest-platform/frontend/dist;
try_files $uri $uri/ /index.html;
}
# Backend API
location /api/ {
proxy_pass http://localhost:8000/api/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
# Increase timeouts for long-running requests
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
}
# Logs
access_log /var/log/nginx/llm-perf-platform-access.log;
error_log /var/log/nginx/llm-perf-platform-error.log;
}启用站点:
sudo ln -s /etc/nginx/sites-available/llm-perf-platform /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx# 启动服务
sudo systemctl start llm-perf-backend
# 停止服务
sudo systemctl stop llm-perf-backend
# 重启服务
sudo systemctl restart llm-perf-backend
# 查看状态
sudo systemctl status llm-perf-backend
# 查看日志
sudo journalctl -u llm-perf-backend -f
# 或查看文件日志
tail -f llm-perf-platform/logs/backend.log
tail -f llm-perf-platform/logs/backend-error.log# 测试配置
sudo nginx -t
# 重载配置
sudo systemctl reload nginx
# 重启服务
sudo systemctl restart nginx
# 查看日志
sudo tail -f /var/log/nginx/llm-perf-platform-access.log
sudo tail -f /var/log/nginx/llm-perf-platform-error.log在 llm-perf-platform/.env 文件中配置:
# 数据库
# 默认位置: llm_perf_platform/database.db
# 取消注释以覆盖默认位置:
# LLM_PERF_DB_PATH=/custom/path/to/database.db
# 日志目录
LLM_PERF_LOG_DIR=./logs
# Appauto 路径
APPAUTO_PATH=/path/to/appauto
# API 配置
API_HOST=0.0.0.0
API_PORT=8000
# 默认管理员账号
DEFAULT_ADMIN_EMAIL=admin@example.com
DEFAULT_ADMIN_PASSWORD=admin123
# 任务调度器
TASK_SCHEDULER_MAX_WORKERS=5在 frontend/.env 文件中配置(可选):
# API Base URL
# 开发环境:可以设置为后端 API 地址(如 http://localhost:8000/api)
# 生产环境:使用相对路径 /api(由 Nginx 反向代理处理)
# 默认值:/api
VITE_API_BASE=/api注意:
- 前端默认使用相对路径
/api,适用于生产环境(Nginx 部署) - 开发环境下 Vite 会自动代理
/api到http://localhost:8000 - 无需修改环境变量,除非有特殊需求
cd llm-perf-platform
source .venv/bin/activate
# 查看当前版本
alembic current
# 升级到最新版本
alembic upgrade head
# 回滚一个版本
alembic downgrade -1
# 查看迁移历史
alembic history- 检查 Python 版本:
python3 --version(需要 >= 3.10) - 检查虚拟环境:
source .venv/bin/activate - 检查依赖:
pip list - 查看日志:
tail -f logs/backend-error.log
- 检查 appauto 路径是否正确:
ls -la /path/to/appauto - 检查
pyproject.toml中的 appauto 路径:grep appauto pyproject.toml - 手动更新 pyproject.toml 中的路径后重新安装:
pip install -e . - 或在
.env文件中设置APPAUTO_PATH环境变量
- 检查 Node.js 版本:
node --version(需要 >= 18) - 清理缓存:
rm -rf node_modules package-lock.json && npm install - 检查构建日志
- 检查浏览器控制台网络请求
- 生产环境:确认 Nginx 配置正确并已重启
- 开发环境:确认后端在
http://localhost:8000运行 - 检查 CORS 配置(如果跨域请求)
- 检查数据库文件权限
- 运行数据库迁移:
alembic upgrade head - 如需重置:删除
llm_perf_platform.db后重新运行迁移
- 检查后端服务是否运行:
sudo systemctl status llm-perf-backend - 检查端口是否正确:
netstat -tuln | grep 8000 - 查看 Nginx 错误日志:
sudo tail -f /var/log/nginx/error.log
- 在
llm_perf_platform/api/下创建或修改路由文件 - 在
llm_perf_platform/api/router.py中注册路由 - 添加相应的类型定义到
frontend/src/types.ts - 在
frontend/src/api.ts中添加 API 客户端函数
- 修改
llm_perf_platform/models/下的模型 - 创建迁移:
alembic revision --autogenerate -m "描述" - 应用迁移:
alembic upgrade head
- 主应用:
frontend/src/App.tsx - 样式:
frontend/src/styles.css - 类型定义:
frontend/src/types.ts - API 客户端:
frontend/src/api.ts
- 修改默认管理员密码:首次登录后立即修改
- 使用 HTTPS:生产环境务必配置 SSL 证书
- 配置防火墙:只开放必要的端口(80, 443)
- 定期备份:备份数据库文件和结果文件
- 更新依赖:定期更新系统和应用依赖
[指定你的许可证]
欢迎提交 Issue 和 Pull Request!
如有问题,请提交 Issue 或联系维护团队。