sgl-project/sglang · warning · FutureWarning

`sglang.bench_serving` is deprecated and will be removed in

Error message

`sglang.bench_serving` is deprecated and will be removed in a future release; use `sglang.benchmark.serving` instead (e.g. `python -m sglang.benchmark.serving`).

What it means

FutureWarning issued by the legacy shim sglang.bench_serving: the serving (online) benchmark was relocated to sglang.benchmark.serving. Importing the old path re-exports the new module and warns of future removal.

Source

Thrown at python/sglang/bench_serving.py:13

"""Deprecated import path for ``sglang.benchmark.serving``.

``python -m sglang.bench_serving`` and ``from sglang.bench_serving import ...``
still work, but the implementation now lives in ``sglang.benchmark.serving``.
Update references to the new path.
"""

import warnings

from sglang.benchmark.serving import *  # noqa: F401,F403
from sglang.benchmark.serving import cli_main

warnings.warn(
    "`sglang.bench_serving` is deprecated and will be removed in a future "
    "release; use `sglang.benchmark.serving` instead "
    "(e.g. `python -m sglang.benchmark.serving`).",
    FutureWarning,
    stacklevel=1,
)

if __name__ == "__main__":
    cli_main()

View on GitHub (pinned to 0132848349)

Solutions

  1. Switch to python -m sglang.benchmark.serving
  2. Update any Python imports to sglang.benchmark.serving
  3. Add -W ignore::FutureWarning only if the invoking script is out of your control

Example fix

# before
python -m sglang.bench_serving --backend sglang --dataset-name sharegpt ...
# after
python -m sglang.benchmark.serving --backend sglang --dataset-name sharegpt ...
Defensive patterns

Strategy: fallback

Validate before calling

import importlib.util
name = "sglang.benchmark.serving" if importlib.util.find_spec("sglang.benchmark.serving") else "sglang.bench_serving"

Prevention

When it happens

Trigger: Running python -m sglang.bench_serving (the classic benchmark-serving command) or importing sglang.bench_serving.

Common situations: Widely-copied benchmark commands from older blog posts/docs/CI jobs; wrapper scripts that hardcode the old module path.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/006195dc9204a5d1. Report an issue: GitHub.