SuperAPI AI 工具集

vllm-bench-serve

部署与运维

查看项目

更新于 10-15 23:34

技能介绍

用途:vllm bench serve 是 vLLM 提供的基准测试 CLI,用于对 vLLM 或任意 OpenAI 兼容服务端点施加可配置请求负载,测量吞吐量、延迟(TTFT、TPOT、ITL、E2EL)和 goodput。

前提:已安装 vLLM(或已有 OpenAI 兼容服务在运行);已有正在提供模型的服务或 API 端点;基准客户端需具备含 vLLM 的 Python 环境。

基本用法: vllm bench serve --backend openai-chat --host 127.0.0.1 --port 8000 --model Qwen/Qwen2.5-1.5B-Instruct --endpoint /v1/chat/completions 使用 --save-result、--result-dir 保存 JSON 结果,可用 --metadata 记录版本等。注意 --backend openai-chat 时必须指定 --endpoint /v1/chat/completions(默认是 /v1/completions)。

主要能力:支持多种后端(openai、openai-chat、openai-embeddings、vllm、vllm-pooling、vllm-rerank 等);支持多种数据集(random、sharegpt、sonnet、hf、custom/custom_mm、prefix_repetition、random-mm、spec_bench),部分需 --dataset-path;可控制请求速率(--request-rate,Poisson)、突发性(--burstiness)、限流并发(--max-concurrency)、线性爬坡(--ramp-up-strategy)与预热(--num-warmups);可设置采样参数(temperature、top-p、top-k 等);结果可选详细模式(--save-detailed)、百分位指标(--percentile-metrics、--metric-percentiles)与 goodput SLO(--goodput ttft:500 tpot:50)。

适用场景:吞吐与延迟测试、固定 QPS 延迟测试、远程 API 基准、容器内运行(docker exec)。

限制与排错:连接被拒需检查服务与 host/port/base-url;模型未找到需显式 --model;429 需降低请求率或并发;自签名证书可用 --insecure;--profile 需服务端 --profiler-config。--ready-check-timeout-sec 可用于等待端点就绪。