yy-fighting 06b3398ad0 feat: add ShareGPT dataset scenarios to SGLang vs vLLM comparison
- config.env: add SHAREGPT_DATASET, SHAREGPT_CONTEXT_LEN and SHAREGPT_SCENARIOS
- run_bench.sh: add run_sharegpt() and integrate it after Phase 1 for each backend
- parse_backend.py: support both phase{1|2} and sharegpt raw output filenames
- README.md: document ShareGPT scenarios
2026-07-08 07:42:05 +00:00

82 lines
2.5 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.

# DSV4 H200 SGLang vs vLLM 对比实验
在 8x NVIDIA H200 上,用统一控制变量对比 SGLang 与 vLLM serving DeepSeek-V4-Flash。
## 设计原则
- 两个 backend 都使用 **TP=8**,绑定全部 8 张卡。
- 压测客户端统一使用 `sglang.bench_serving`
- 场景矩阵、并发、输入/输出长度、请求数对两个 backend 完全一致。
- 每个 phase 启动 server 后先做 warmup再跑正式压测。
- 短上下文和长上下文分阶段启动 server避免 `max-model-len` / `max-num-seqs` 显存冲突。
## 场景矩阵
### Phase 1短上下文吞吐max_model_len=32k
| Concurrency | Input | Output | Num prompts |
|---:|---:|---:|---:|
| 1 | 512 | 256 | 32 |
| 32 | 512 | 256 | 128 |
| 128 | 512 | 256 | 128 |
| 1 | 4000 | 512 | 32 |
| 32 | 4000 | 512 | 64 |
### Phase 2长上下文max_model_len=210k
| Concurrency | Input | Output | Num prompts |
|---:|---:|---:|---:|
| 1 | 32768 | 1024 | 8 |
| 1 | 65536 | 1024 | 4 |
| 1 | 131072 | 1024 | 2 |
| 1 | 200000 | 1024 | 1 |
### ShareGPT 真实对话数据max_model_len=32k
| Concurrency | ShareGPT context len | Output | Num prompts |
|---:|---:|---:|---:|
| 1 | 32768 | 256 | 32 |
| 32 | 32768 | 256 | 128 |
使用 `datasets/ShareGPT_filtered_chat.json``--sharegpt-context-len 32768` 会自动过滤超长请求。
## 快速运行
```bash
bash experiments/dsv4_h200_sglang_vs_vllm/run_bench.sh
```
结果保存在 `experiments/dsv4_h200_sglang_vs_vllm/results/<RUN_ID>/`
```
results/<RUN_ID>/
├── sglang/
│ ├── results.json
│ ├── report.md
│ └── raw_outputs/ # gitignored
├── vllm/
│ ├── results.json
│ ├── report.md
│ └── raw_outputs/ # gitignored
├── comparison.md
└── logs/
```
## 文件说明
| 文件 | 作用 |
|---|---|
| `config.env` | 公共配置:模型路径、端口、场景矩阵、虚拟环境 |
| `start_sglang.sh` | 按 phase 启动 SGLang server |
| `start_vllm.sh` | 按 phase 启动 vLLM server |
| `run_bench.sh` | 总 orchestrator跑 SGLang → 跑 vLLM → 生成对比报告 |
| `warmup.py` | 用 `sglang.bench_serving` 发送少量预热请求 |
| `parse_backend.py` | 解析单个 backend 的 raw jsonl 为 `results.json` + `report.md` |
| `compare.py` | 读取两个 backend 的 `results.json`,生成 `comparison.md` |
## 环境
- SGLM server: `/data/user1/yy/envs/sglang`
- vLLM server: `/data/user1/yy/envs/vllm`
- Benchmark client: `/data/user1/yy/envs/sglang`(统一用该环境的 `sglang.bench_serving`