Skip to main content

benchscope

vLLM / SGLang 推理服务性能测试 Web 工具(类似 tensorboard-dashboard 的单进程 pip 工具)。

连接 vLLM / SGLang(或任意 OpenAI 兼容)推理服务的 API 即可进行性能压测, 实时展示并发数-吞吐/时延曲线、日志管理与 xlsx 汇总分析。

功能特性(V1)

  • 双框架:vLLM(vllm bench serve)与 SGLang(sglang.bench_serving), bench 工具在 benchscope 所在机器以子进程运行,推理服务端无需安装任何插件,只需提供 OpenAI 兼容 API。
  • 数据集
    • random:可多选输入/输出长度组合(默认 3K/1K、1K/1K、256/256,可自定义);
    • sharegpt:自动从 modelscope 下载 gliang1001/ShareGPT_V3_unfiltered_cleaned_split (JSON 数组自动流式转换为 jsonl 缓存);
    • 自定义数据集:支持网页上传 jsonl 或填写服务器本地路径,功能与 sharegpt 一致。
  • 测试配置:并发数列表可编辑(默认 1,4,8,16,32,40,64,128), --max-concurrency--num-prompts 保持一致,请求速率可选 inf(不限速); GPU 型号/数量自动检测(nvidia-smi)并可手动编辑;TPOT 阈值设置与最佳并发高亮; 框架常用参数表单 + 自由参数编辑器。
  • 实时结果:每个并发结果实时入表(表头中英双语), 六条曲线(Output 吞吐 / Total 吞吐 / TTFT mean / TPOT mean / TTFT P99 / TPOT P99),横轴并发数。
  • 日志:每次测试一个 月日-时分秒 目录,含原始 bench 日志、mean 汇总 CSV、P99 汇总 CSV、 benchmark-*.xlsx(均值 / P99 双 sheet,列:GPU、模型、精度、推理框架、输入长度、输出长度、 并发数、output、peakoutput、total、ttft、itl、tpot、单用户=1000/tpot),支持预览与下载。
  • 分析:均值 / P99 两大分析块,output/peakoutput/total/ttft/itl/tpot 六曲线; 指定 TPOT 阈值后自动标记最接近(低于)阈值的记录为最佳并发。
  • 状态监控:顶部导航实时显示 网站服务 / 推理服务 就绪或离线,推理服务断开自动变更状态。

安装与启动

# 后端依赖
pip install -e .

# 前端(可选,若 webui/ 已有构建产物可跳过)
cd web && npm install && npm run build && cd ..

# 启动(默认 http://0.0.0.0:8080,自动打开浏览器)
benchscope
# 或指定端口 / 不自动开浏览器
benchscope --port 8080 --no-browser

开发模式:

# 终端 1:后端
python -m benchscope.cli --port 8080 --no-browser
# 终端 2:前端热更新(代理到 8080)
cd web && npm run dev    # http://127.0.0.1:5173

服务设置

打开页面右上角「服务设置」:

  • Base URL:推理服务 OpenAI 兼容地址(默认 http://192.168.1.67:8000), Endpoint、API Key、额外请求头;
  • GPU 自动检测(nvidia-smi)或手动填写;
  • 日志目录 logs_dir 与数据集缓存目录 datasets_dir(默认 ./logs./datasets);
  • TPOT 阈值默认值、请求速率默认值;
  • bench 执行命令模板:vllm bench serve / python -m sglang.bench_serving

使用流程

  1. 打开页面,确认顶部「推理服务:就绪」;
  2. 进入 vLLM 或 SGLang 测试页,选择模型(来自 /v1/models)、数据集、并发数等;
  3. 点击「命令预览」确认将要执行的 bench 命令,点击「开始测试」;
  4. 实时结果面板逐条刷新,曲线实时更新;日志分析面板可查看原始日志、汇总与 xlsx;
  5. 测试完成后自动生成 logs/<月日-时分秒>/benchmark-*.xlsx(均值 + P99 双 sheet)。

目录结构

benchscope/
├── benchscope/
│   ├── cli.py                # benchscope 命令入口
│   ├── config.py             # 配置持久化 (~/.benchscope/config.json)
│   ├── constants.py          # 默认值(并发列表、长度组合等)
│   ├── datasets.py           # sharegpt 下载/转换、自定义数据集
│   ├── gpu.py                # GPU 自动检测
│   ├── parser.py             # bench 输出解析(mean + P99)
│   ├── summary.py            # CSV 与 xlsx 汇总生成
│   ├── benches/              # vllm/sglang 命令构建与执行
│   └── server/               # FastAPI + WebSocket + 测试编排
├── web/                      # Vue3 + Ant Design Vue 前端源码
├── asserts/                  # 参考脚本与样例日志(test-non.py 等)
└── tests/mock_openai_server.py  # 本地联调用模拟 OpenAI 服务

开发调试

  • 无 vllm/sglang 环境联调:设置环境变量 BENCHSCOPE_FAKE_BENCH=1 后启动,bench 将以仿真数据执行;
  • 本地模拟推理服务:python tests/mock_openai_server.py(端口 8001), 在服务设置中把 Base URL 指向 http://127.0.0.1:8001

规划

V1 纯文本性能测试(本版本)→ V2 多模态模型测试 → V3 全模态 → V4 世界模型; V5 常见数据集精度测试 → V6 modelscope 官方模型对比分析。

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

benchscope-1.0.0.tar.gz (903.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

benchscope-1.0.0-py3-none-any.whl (915.5 kB view details)

Uploaded Python 3

File details

Details for the file benchscope-1.0.0.tar.gz.

File metadata

  • Download URL: benchscope-1.0.0.tar.gz
  • Upload date:
  • Size: 903.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.12

File hashes

Hashes for benchscope-1.0.0.tar.gz
Algorithm Hash digest
SHA256 33fab34b85aa154bfdf552ba8e9df543a14c37acd1185bdd6d166be14f54def3
MD5 7120240cc2fab9ded58c4c414d8f4115
BLAKE2b-256 de377dddba00f7d80b8b6810fc682dce7ba0ac7f980d4b211e5a189fce3f27e6

See more details on using hashes here.

File details

Details for the file benchscope-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: benchscope-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 915.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.12

File hashes

Hashes for benchscope-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c4a0db6477320f936a5966543b2fb83682e240c12ec93159849ceeb054986ff2
MD5 0169728bc6f37db4cc39bacb17f9a917
BLAKE2b-256 a105955ba4e75a407c185a114fd8058c3aa12aa63a2d31285c9447576a5c906d

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

This release

1.0.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page