Qwen/Qwen2.5-7B-Instruct), multimodal vision (Qwen/Qwen2.5-VL-7B-Instruct), and embedding (Qwen/Qwen3-Embedding-8B) — in both online and offline serving modes. You can use Evalscope, AISBench, or SGLang’s built-in benchmarking tools.
The benchmark output examples in this guide are for illustration only. Actual performance depends on your hardware (e.g., Atlas 800I A2 vs A3), model version, SGLang version, and deployment configuration. Always run benchmarks on your own hardware to obtain accurate performance data.
1. Prepare
1.1 Start SGLang server
Launch the server with the appropriate flags for each model type. Make sure SGLang is installed first — see Ascend NPU Quickstart for environment setup.- Text Generation
- Multimodal
- Embedding
Command
The server binds to
http://127.0.0.1:30000 by default. All online benchmarks below assume the server is running at that address. The --is-embedding flag is required for embedding models.1.2 Install benchmarking tools
bench_serving and bench_offline_throughput are built into SGLang and require no extra installation. For Evalscope and AISBench, set up each in its own virtual environment:
- Evalscope
- AISBench
Command
2. Online Service: Text Generation Model
TestQwen/Qwen2.5-7B-Instruct via the online serving endpoint.
Before running any benchmark in this section, make sure the SGLang text-generation server is running at
http://127.0.0.1:30000. See Start SGLang server for the launch command.2.1 Using Evalscope
Prerequisites: Evalscope installed and its virtual environment activated (
source .evalscope_venv/bin/activate). SGLang server running at http://127.0.0.1:30000.Command
See the Evalscope Performance Testing Guide for full details.
2.2 Using AISBench
Prerequisites: AISBench installed and its virtual environment activated (
source .aisbench_venv/bin/activate). All commands must be run from the benchmark/ directory. SGLang server running at http://127.0.0.1:30000. Set stream=True and ignore_eos=True in the model config for accurate results.ais_bench/benchmark/configs/models/vllm_api/vllm_api_stream_chat.py:
vllm_api_stream_chat.py
ais_bench/datasets/synthetic/synthetic_config.py:
synthetic_config.py
Command
See the AISBench Documentation for details.
2.3 Using bench_serving
SGLang’s built-inbench_serving requires no extra installation. Make sure the server is running at http://127.0.0.1:30000 before running the benchmark.
See the Bench Serving Guide for all backends, datasets, and advanced options.
Command
--dataset-name random samples token IDs from the ShareGPT dataset to generate realistic input; the first run downloads ShareGPT from Hugging Face automatically.- If you have network issues, set
export HF_ENDPOINT=https://hf-mirror.comto use domestic mirror. - If downloading still fails, manually download the dataset file
ShareGPT_V3_unfiltered_cleaned_split.jsonlocally, upload it to your server, then specify the file directory via--dataset-pathto run offline.
SGLang Serving Benchmark Result — Complete Reference
The output format is hardcoded inbench_serving.py. All formatting decisions — including column widths, alignment, and decimal precision — are statically defined in the source and cannot be changed via command-line arguments.
Test Configuration
| Parameter | Description |
|---|---|
Backend | The serving backend under test (e.g., sglang, vllm). |
Traffic request rate | Request generation rate in req/s. inf means maximum rate (concurrency-bounded). trace indicates trace timestamp mode. A fixed value enforces constant inter-arrival time. |
Max request concurrency | Maximum number of concurrent requests from the client side. Displays not set when unspecified. |
Core Statistics & Throughput Metrics
| Parameter | Description | Format Specification |
|---|---|---|
Successful requests | Total number of successfully completed requests (HTTP 200, no generation errors). | Integer, no decimal places |
Benchmark duration (s) | Total elapsed time from first request sent to last response fully received (seconds). | 2 decimal places |
Total input tokens | Total number of input (prompt) tokens across all requests, counted by server-side tokenizer. | Integer, no decimal places |
Total input text tokens | Same as Total input tokens. For multimodal inputs, this may differ. | Integer, no decimal places |
Total generated tokens | Total number of output tokens actually generated by the server (server-side tokenizer count). | Integer, no decimal places |
Total generated tokens (retokenized) | Output text re-tokenized by the client using its own tokenizer. A large discrepancy indicates tokenizer mismatch or special tokens in output. | Integer, no decimal places |
Request throughput (req/s) | Number of successful requests processed per second. Formula: Successful requests / Benchmark duration (s). | 2 decimal places |
Input token throughput (tok/s) | Number of input tokens processed per second. Formula: Total input tokens / Benchmark duration (s). | 2 decimal places |
Output token throughput (tok/s) | Number of output tokens generated per second. Formula: Total generated tokens / Benchmark duration (s). | 2 decimal places |
Peak output token throughput (tok/s) | Observed instantaneous peak output token generation rate during the test (computed over a sliding window). | 2 decimal places |
Peak concurrent requests | Maximum number of requests being processed simultaneously on the server side. May exceed client-side Max request concurrency due to queueing. | Integer, no decimal places |
Total token throughput (tok/s) | Sum of input and output token throughputs. Formula: Input token throughput + Output token throughput. | 2 decimal places |
Concurrency | Average number of concurrent requests during the test (Little’s Law). Formula: Sum of all E2E latencies / Benchmark duration. | 2 decimal places |
End-to-End Latency (E2E Latency)
| Statistic | Description | Format |
|---|---|---|
Mean E2E Latency (ms) | Arithmetic mean | 2 decimal places |
Median E2E Latency (ms) | 50th percentile | 2 decimal places |
P90 E2E Latency (ms) | 90th percentile (90% of requests have latency ≤ this value) | 2 decimal places |
P99 E2E Latency (ms) | 99th percentile | 2 decimal places |
Time to First Token (TTFT)
| Statistic | Description | Format |
|---|---|---|
Mean TTFT (ms) | Arithmetic mean | 2 decimal places |
Median TTFT (ms) | 50th percentile | 2 decimal places |
P99 TTFT (ms) | 99th percentile | 2 decimal places |
Time per Output Token (TPOT) – Excluding First Token
Formula:(E2E Latency - TTFT) / (Number of output tokens - 1)
| Statistic | Description | Format |
|---|---|---|
Mean TPOT (ms) | Arithmetic mean | 2 decimal places |
Median TPOT (ms) | 50th percentile | 2 decimal places |
P99 TPOT (ms) | 99th percentile | 2 decimal places |
Inter-Token Latency (ITL)
| Statistic | Description | Format |
|---|---|---|
Mean ITL (ms) | Average inter-token interval | 2 decimal places |
Median ITL (ms) | 50th percentile inter-token interval | 2 decimal places |
P95 ITL (ms) | 95th percentile (used to detect stalls) | 2 decimal places |
P99 ITL (ms) | 99th percentile | 2 decimal places |
Max ITL (ms) | Maximum observed inter-token interval; useful for identifying severe blocking events | 2 decimal places |
3. Online Service: Multimodal Model
TestQwen/Qwen2.5-VL-7B-Instruct for vision-language tasks.
Before running any benchmark in this section, make sure the SGLang multimodal server is running at
http://127.0.0.1:30000. See Start SGLang server and use the Multimodal tab for the launch command.3.1 Using Evalscope
Prerequisites: Evalscope installed and its virtual environment activated (
source .evalscope_venv/bin/activate). SGLang multimodal server running at http://127.0.0.1:30000.perf tool uses the OpenAI-compatible /v1/chat/completions endpoint. Use --dataset random_vl for randomized multimodal data with image generation:
Command
3.2 Using AISBench
Prerequisites: AISBench installed and its virtual environment activated (
source .aisbench_venv/bin/activate). All commands run from the benchmark/ directory. SGLang multimodal server running at http://127.0.0.1:30000. AISBench does not include a built-in multimodal dataset — you must provide your own.ais_bench/benchmark/configs/models/vllm_api/vllm_api_stream_chat.py to configure the vision model:
vllm_api_stream_chat.py
Command
Command
See the AISBench Documentation for details.
3.3 Using bench_serving (image dataset)
Set--dataset-name image for image datasets. bench_serving will generate random prompts with image inputs. Make sure the server is running at http://127.0.0.1:30000 before running the benchmark.
See the Bench Serving Guide for the full list of image-related flags.
Command
4. Online Service: Embedding Model
TestQwen/Qwen3-Embedding-8B on the embedding API endpoint.
Before running any benchmark in this section, make sure the SGLang embedding server is running with
--is-embedding at http://127.0.0.1:30000. See Start SGLang server and use the Embedding tab for the launch command. AISBench does not support embedding endpoints — use bench_serving or Evalscope instead.4.1 Using Evalscope
Prerequisites: Evalscope installed and its virtual environment activated (
source .evalscope_venv/bin/activate). SGLang embedding server running with --is-embedding at http://127.0.0.1:30000.Command
Evalscope’s embedding performance testing support may vary by version. If the
perf command does not accept the embeddings endpoint, use bench_serving with --backend sglang-embedding as the primary option.4.2 Using bench_serving (embedding backend)
bench_serving is built into SGLang. Use --backend sglang-embedding to target the /v1/embeddings endpoint. Make sure the server is running with --is-embedding at http://127.0.0.1:30000.
Command
--dataset-name random samples token IDs from the ShareGPT dataset; the first run downloads ShareGPT from Hugging Face automatically. Set export HF_ENDPOINT=https://hf-mirror.com if network is not available. Set --random-output-len 0 for embedding benchmarks — no output tokens are generated.5. Offline Performance Testing
SGLang’sEngine API runs inference in-process, without an HTTP server, letting you measure maximum throughput. bench_offline_throughput is built into SGLang and requires no extra installation or running server.
bench_offline_throughput currently only supports text-generation (LLM) benchmarks. Multimodal and embedding models are not supported.5.1 Using bench_offline_throughput
bench_offline_throughput uses the Engine API internally and measures pure inference throughput without HTTP overhead:
Command
--dataset-name random samples token IDs from the ShareGPT dataset; the first run downloads ShareGPT from Hugging Face automatically. Set export HF_ENDPOINT=https://hf-mirror.com if network is not available.See also
- Bench Serving Guide — all backends, datasets, and advanced options for
bench_serving - Ascend NPU Quickstart — environment setup for Ascend NPUs
- Evalscope Performance Testing Guide — full Evalscope documentation
- AISBench Documentation — full AISBench documentation
