[Performance]: trtllm-serve's default of 8 HTTP frontends is ~20% slower than 4 at 128–512 concurrent streams (Qwen3-8B, GB200)

オープン
#22,130 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python, pytorch

調査の方向性

Start by reading the frontend-count change in #19379 and the worker batching path in tensorrt_llm/executor/base_worker.py, especially handle_for_ipc_batched. Reproduce the throughput sweep with Qwen3-8B on a GB200, varying --num_serve_frontends from 1 to 8 at 128–512 concurrent streams. Done means identifying whether the default causes the reported slowdown and providing measured results that support a default or implementation change.

索引モデルが issue の本文から書いたものです。

説明

General perf
Report of performance regression

Since #19379, trtllm-serve serve starts 8 HTTP frontend processes by default. On one GB200 with Qwen3-8B BF16 and 256 concurrent streaming /v1/completions requests, 8 frontends delivered about 19% fewer tokens per second than 4. The server command is the same in every run except --num_serve_frontends; each load wave uses its own random prompts.

CPUs available to the server 8 frontends (default), tok/s 4 frontends, tok/s
12 17,351 / 16,170 / 15,863 · 17,519 / 16,152 / 16,399 20,989 / 21,002 / 21,858 · 20,302 / 18,995 / 20,257
24 20,192 / 18,712 / 19,129 · 19,755 / 17,337 / 19,942 23,533 / 24,188 / 23,467 · 22,964 / 23,965 / 23,239

Each cell is two server launches (separated by ·) with three load waves each, run in the order 8, 4, 8, 4 (12 CPUs) and 4, 8, 4, 8 (24 CPUs). In both settings every 4-frontend wave was faster than every 8-frontend wave of the same launch pair, by at least 8% (12 CPUs) and 15% (24 CPUs). In a separate run on 12 CPUs, 2 frontends averaged 20,260 tok/s and 1 frontend 17,387 tok/s; with 1 frontend, in two of three waves the GPU went idle about 5 s before the last token reached the client. In two other runs of the 8-frontend server without streaming, the same load reached 23,344 and 25,479–25,624 tok/s.

A concurrency sweep on 12 CPUs (CUDA graphs extended to batch 512 so that 512-stream decode is not eager; two launches per frontend count in the order 8, 4, 4, 8; two waves per concurrency per launch) gave:

concurrent streams 8 frontends, mean tok/s 4 frontends, mean tok/s 4 / 8
64 9,234 10,246 1.11
128 12,485 15,197 1.22
256 15,440 19,566 1.27
512 18,530 22,807 1.23

At 128, 256 and 512 streams every 4-frontend wave was faster than every 8-frontend wave of the same launch pair, by at least 8%; at 64 the second launch pair overlapped.

A py-spy sample (100 Hz, 6 s inside one streaming wave per configuration, 12 CPUs) is consistent with an overhead that grows with the number of frontend processes. The numbers below are sampled time divided by an estimated step count (wave time / 1,024), so they are approximate, and py-spy on this platform does not separate GIL waits from running:

py-spy time per estimated decode step 8 frontends 4 frontends
worker executor loop thread 12.7 ms 9.8 ms
worker await_response_thread (per-lane pickle, HMAC, send) 3.9 ms 2.8 ms
all frontend processes together 21.2 ms 15.1 ms

Total server CPU in top was 2.7–2.8 of the 12 allocated cores in both runs. One possible explanation is the per-lane work in the worker, which groups each batch of responses by frontend and sends one IPC message per non-empty group (handle_for_ipc_batched); this was not isolated.

Is 8 the intended default at these concurrencies? The description of #19379 motivates the change with c ≥ 512 on a DSv4 disaggregated generation worker. In these runs 4 frontends gave higher throughput than 8 from 128 to 512 streams, and 2 frontends did as well at 256.

Your current environment (if you think it is necessary)
  • 1× NVIDIA GB200 (Grace, aarch64), Slurm job with 12 or 24 CPUs (half on each Grace socket); the server uses one GPU
  • nvcr.io/nvidia/tensorrt-llm/release:1.4.0rc3.dev202611050315 (arm64), PyTorch backend
  • Qwen3-8B BF16, TP 1

Server (8 frontends is the default; the 4-frontend runs add --num_serve_frontends 4; the concurrency sweep used cuda_graph_config.max_batch_size: 512):

cat > cfg.yaml <<'EOF'
cuda_graph_config:
  enable_padding: true
  max_batch_size: 256
kv_cache_config:
  host_cache_size: 8589934592
EOF
trtllm-serve serve Qwen/Qwen3-8B --served_model_name m --host 127.0.0.1 --port 8000 --config cfg.yaml

The CUDA graph settings follow the server's own startup warning for decode batches above 32; host_cache_size keeps the KV host tier inside the job's memory limit.

Load (simplified from the harness used): after wave 9 16 128 as a warm-up, send 256 requests at once (64 to 512 in the sweep), each with 256 random prompt token ids, max_tokens 1024, ignore_eos and streaming with usage; a wave counts only if every request returns HTTP 200 with curl exit code 0, [DONE] and 1,024 completion tokens. Throughput = requests × 1024 / wall time from the first request to the last response; three waves per server launch (two per concurrency in the sweep).

wave() {  # wave <seed> [n] [max_tokens]
  rm -rf bodies out && mkdir -p bodies out
  n=${2:-256}; m=${3:-1024}
  python3 - "$1" "$n" "$m" <<'EOF'
import json, random, sys
rng = random.Random(int(sys.argv[1]))
for i in range(int(sys.argv[2])):
    body = {"model": "m", "prompt": [rng.randrange(1000, 100000) for _ in range(256)], "max_tokens": int(sys.argv[3]),
            "ignore_eos": True, "stream": True, "stream_options": {"include_usage": True}}
    json.dump(body, open(f"bodies/r{i:03d}.json", "w"))
EOF
  t0=$(date +%s.%N)
  ls bodies/*.json | xargs -P "$n" -I{} sh -c 'curl -s -N -o out/$(basename {}).resp -w "%{http_code} %{exitcode}\n" -H "Content-Type: application/json" --data-binary @{} http://127.0.0.1:8000/v1/completions' > codes.txt
  t1=$(date +%s.%N)
  python3 - "$t0" "$t1" "$n" "$m" <<'EOF'
import glob, json, sys
n, m = int(sys.argv[3]), int(sys.argv[4])
codes = [ln.split() for ln in open("codes.txt") if ln.strip()]
ok = 0
for f in glob.glob("out/*.resp"):
    parts = [p.strip() for p in open(f).read().split("data: ")]
    usage = [json.loads(p)["usage"] for p in parts if p.startswith("{") and '"usage"' in p and json.loads(p).get("usage")]
    ok += "[DONE]" in parts and bool(usage) and usage[-1]["completion_tokens"] == m
good = sum(c == ["200", "0"] for c in codes)
assert len(codes) == n and good == n and ok == n, (len(codes), good, ok)
print(round(n * m / (float(sys.argv[2]) - float(sys.argv[1]))), "tok/s")
EOF
}
wave 9 16 128; wave 1; wave 2; wave 3

For the concurrency sweep, cfg.yaml sets max_batch_size: 512 under cuda_graph_config, and each launch runs wave SEED N twice for each n in 64, 128, 256, 512.

Not run: concurrency above 512, other models, x86 hosts, or a full GB200 node (all runs used 12 or 24 CPUs and one GPU).

Before submitting a new issue...
  • Make sure you already searched for relevant issues, and checked the documentation and examples for answers to frequently asked questions.
主要言語
Python
スター
15.2k
フォーク
3k
平均マージ
2日 21時間
マージ済み PR(30日)
477

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

NVIDIA/TensorRT-LLM のほかの issue

NVIDIA/TensorRT-LLM の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。