当前位置: 首页 > news >正文

旅游网站制作视频百度云公司网站与推广

旅游网站制作视频百度云,公司网站与推广,大学制作网站怎么做,天津响应式网站建设制作文章目录 分析步骤案例案例描述测试数据集 原始数据〇轮测试(enable-64)一轮测试(enable-128)二轮测试(enable-256)三轮测试(enable-512)四轮测试(enable-2048&#xff0…

文章目录

  • 分析步骤
  • 案例
    • 案例描述
    • 测试数据集
  • 原始数据
    • 〇轮测试(enable-64)
    • 一轮测试(enable-128)
    • 二轮测试(enable-256)
    • 三轮测试(enable-512)
    • 四轮测试(enable-2048)
    • 五轮测试(enable-4096)
    • 六轮测试(enable-8192)
    • 七轮测试(disable-256)
    • 八轮测试(disable-512)
    • 九轮测试(disable-2048)
    • 十轮测试(disable-4096)
    • 十一轮测试(disable-8192)
  • 数据可视化
    • 数据汇总说明
    • 总览-耗时&吞吐量
    • TTFT(Time To First Token)
    • TPOT(Time per Output Token)
    • ITL(Inter-token Latency)
  • 结论

本篇为 vLLM 性能测试分析篇,vLLM 调研文档请看 vLLM 调研文档

分析步骤

  1. 通过设置环境变量 VLLM_TORCH_PROFILER_DIR 到你想要保存追踪文件的目录来启用追踪,例如:VLLM_TORCH_PROFILER_DIR=/mnt/traces/。OpenAI 服务也需要在设置了VLLM_TORCH_PROFILER_DIR环境变量的情况下启动

    docker run --runtime nvidia --gpus all \-v /data1/data_vllm:/data \-p 8001:8000 \-e VLLM_TORCH_PROFILER_DIR=/data/mnt/traces/ \--name qwen_llm_3 \--ipc=host \swr.cn-east-3.myhuaweicloud.com/kubesre/docker.io/vllm/vllm-openai \--model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 \--max-model-len 102400
    
  2. 使用benchmarks/benchmark_serving.py脚本进行性能测试,输出测试数据集请求情况,以及内存跟踪日志:

    /usr/bin/python3 vllm/benchmarks/benchmark_serving.py --backend vllm --model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 --dataset ShareGPT_V3_unfiltered_cleaned_split.json --profile--dataset ShareGPT_V3_unfiltered_cleaned_split.json:这个参数指定了用于测试的数据集
    --profile:启用性能分析。意味着在运行测试时会收集性能相关的数据,如 GPU 和内存使用情况以及处理请求所需的时间。
    
  3. 上传跟踪日志到 https://ui.perfetto.dev/ 可以进行内存占用可视化分析

案例

案例描述

本案例将分析 --enable-chunked-prefill 的启用/禁用以及 --max-num-batched-tokens 参数的调整对性能的影响情况。
参数描述请参考官方文档:https://docs.vllm.ai/en/stable/models/performance.html#chunked-prefill

测试数据集

线上拉取:https://github.com/vllm-project/vllm/blob/main/benchmarks/README.md

原始数据

〇轮测试(enable-64)

  • 启动参数
docker run --runtime nvidia --gpus all \-v /data1/data_vllm:/data \-p 8001:8000 \-e VLLM_TORCH_PROFILER_DIR=/data/mnt/traces/ \--name qwen_llm_3 \--ipc=host \swr.cn-east-3.myhuaweicloud.com/kubesre/docker.io/vllm/vllm-openai \--model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 \--max-model-len 102000 \--max-num-batched-tokens 64 \--max-num-seqs 64python3 vllm/benchmarks/benchmark_serving.py --backend vllm --model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 --dataset ShareGPT_V3_unfiltered_cleaned_split.json --profile
  • 测试结果
Starting profiler...
Traffic request rate: inf
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [07:38<00:00,  1.63s/it]Stopping profiler...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [07:38<00:00,  2.18it/s]
============ Serving Benchmark Result ============
Successful requests:                     1000      
Benchmark duration (s):                  458.11    
Total input tokens:                      217393    
Total generated tokens:                  198783    
Request throughput (req/s):              2.18      
Output token throughput (tok/s):         433.92    
Total Token throughput (tok/s):          908.47    
---------------Time to First Token----------------
Mean TTFT (ms):                          220088.62 
Median TTFT (ms):                        221079.64 
P99 TTFT (ms):                           435865.23 
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          67.91     
Median TPOT (ms):                        68.32     
P99 TPOT (ms):                           72.16     
---------------Inter-token Latency----------------
Mean ITL (ms):                           68.05     
Median ITL (ms):                         68.24     
P99 ITL (ms):                            72.45     
==================================================

一轮测试(enable-128)

  • 启动参数
docker run --runtime nvidia --gpus all \-v /data1/data_vllm:/data \-p 8001:8000 \-e VLLM_TORCH_PROFILER_DIR=/data/mnt/traces/ \--name qwen_llm_3 \--ipc=host \swr.cn-east-3.myhuaweicloud.com/kubesre/docker.io/vllm/vllm-openai \--model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 \--max-model-len 102000 \--max-num-batched-tokens 128 \--max-num-seqs 128python3 vllm/benchmarks/benchmark_serving.py --backend vllm --model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 --dataset ShareGPT_V3_unfiltered_cleaned_split.json --profile
  • 测试结果
Starting profiler...
Traffic request rate: inf
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:47<00:00,  1.66it/s]Stopping profiler...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:47<00:00,  2.46it/s]
============ Serving Benchmark Result ============
Successful requests:                     1000      
Benchmark duration (s):                  407.00    
Total input tokens:                      217393    
Total generated tokens:                  198440    
Request throughput (req/s):              2.46      
Output token throughput (tok/s):         487.56    
Total Token throughput (tok/s):          1021.69   
---------------Time to First Token----------------
Mean TTFT (ms):                          189093.46 
Median TTFT (ms):                        186896.79 
P99 TTFT (ms):                           377978.23 
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          119.23    
Median TPOT (ms):                        121.42    
P99 TPOT (ms):                           133.46    
---------------Inter-token Latency----------------
Mean ITL (ms):                           118.04    
Median ITL (ms):                         120.48    
P99 ITL (ms):                            127.46    
==================================================

二轮测试(enable-256)

  • 启动参数
docker run --runtime nvidia --gpus all \-v /data1/data_vllm:/data \-p 8001:8000 \-e VLLM_TORCH_PROFILER_DIR=/data/mnt/traces/ \--name qwen_llm_3 \--ipc=host \swr.cn-east-3.myhuaweicloud.com/kubesre/docker.io/vllm/vllm-openai \--model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 \--max-model-len 102000 \--max-num-batched-tokens 256python3 vllm/benchmarks/benchmark_serving.py --backend vllm --model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 --dataset ShareGPT_V3_unfiltered_cleaned_split.json --profile
  • 测试结果
Starting profiler...
Traffic request rate: inf
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:30<00:00,  1.54it/s]Stopping profiler...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:30<00:00,  2.56it/s]
============ Serving Benchmark Result ============
Successful requests:                     1000      
Benchmark duration (s):                  390.70    
Total input tokens:                      217393    
Total generated tokens:                  198786    
Request throughput (req/s):              2.56      
Output token throughput (tok/s):         508.80    
Total Token throughput (tok/s):          1065.22   
---------------Time to First Token----------------
Mean TTFT (ms):                          165589.63 
Median TTFT (ms):                        163038.00 
P99 TTFT (ms):                           349869.23 
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          222.05    
Median TPOT (ms):                        230.34    
P99 TPOT (ms):                           253.39    
---------------Inter-token Latency----------------
Mean ITL (ms):                           216.90    
Median ITL (ms):                         225.01    
P99 ITL (ms):                            454.54    
==================================================

三轮测试(enable-512)

  • 启动参数
docker run --runtime nvidia --gpus all \-v /data1/data_vllm:/data \-p 8001:8000 \-e VLLM_TORCH_PROFILER_DIR=/data/mnt/traces/ \--name qwen_llm_3 \--ipc=host \swr.cn-east-3.myhuaweicloud.com/kubesre/docker.io/vllm/vllm-openai \--model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 \--max-model-len 102000 \--max-num-batched-tokens 512python3 vllm/benchmarks/benchmark_serving.py --backend vllm --model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 --dataset ShareGPT_V3_unfiltered_cleaned_split.json --profile
  • 测试结果
Starting profiler...
Traffic request rate: inf
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:33<00:00,  1.20it/s]Stopping profiler...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:33<00:00,  2.54it/s]
============ Serving Benchmark Result ============
Successful requests:                     1000      
Benchmark duration (s):                  393.35    
Total input tokens:                      217393    
Total generated tokens:                  198794    
Request throughput (req/s):              2.54      
Output token throughput (tok/s):         505.39    
Total Token throughput (tok/s):          1058.05   
---------------Time to First Token----------------
Mean TTFT (ms):                          145934.18 
Median TTFT (ms):                        130854.88 
P99 TTFT (ms):                           331526.83 
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          413.37    
Median TPOT (ms):                        435.94    
P99 TPOT (ms):                           485.53    
---------------Inter-token Latency----------------
Mean ITL (ms):                           387.35    
Median ITL (ms):                         437.46    
P99 ITL (ms):                            712.21    
==================================================

四轮测试(enable-2048)

  • 启动参数
docker run --runtime nvidia --gpus all \-v /data1/data_vllm:/data \-p 8001:8000 \-e VLLM_TORCH_PROFILER_DIR=/data/mnt/traces/ \--name qwen_llm_3 \--ipc=host \swr.cn-east-3.myhuaweicloud.com/kubesre/docker.io/vllm/vllm-openai \--model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 \--max-model-len 102000 \--max-num-batched-tokens 2048python3 vllm/benchmarks/benchmark_serving.py --backend vllm --model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 --dataset ShareGPT_V3_unfiltered_cleaned_split.json --profile
  • 测试结果
Starting profiler...
Traffic request rate: inf
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:44<00:00,  1.52it/s]Stopping profiler...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:44<00:00,  2.47it/s]
============ Serving Benchmark Result ============
Successful requests:                     1000      
Benchmark duration (s):                  404.65    
Total input tokens:                      217393    
Total generated tokens:                  198641    
Request throughput (req/s):              2.47      
Output token throughput (tok/s):         490.90    
Total Token throughput (tok/s):          1028.13   
---------------Time to First Token----------------
Mean TTFT (ms):                          145587.94 
Median TTFT (ms):                        136750.66 
P99 TTFT (ms):                           333788.49 
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          546.50    
Median TPOT (ms):                        481.48    
P99 TPOT (ms):                           1553.99   
---------------Inter-token Latency----------------
Mean ITL (ms):                           440.14    
Median ITL (ms):                         293.70    
P99 ITL (ms):                            1557.57   
==================================================

五轮测试(enable-4096)

  • 启动参数
docker run --runtime nvidia --gpus all \-v /data1/data_vllm:/data \-p 8001:8000 \-e VLLM_TORCH_PROFILER_DIR=/data/mnt/traces/ \--name qwen_llm_3 \--ipc=host \swr.cn-east-3.myhuaweicloud.com/kubesre/docker.io/vllm/vllm-openai \--model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 \--max-model-len 100928 \--max-num-batched-tokens 4096python3 vllm/benchmarks/benchmark_serving.py --backend vllm --model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 --dataset ShareGPT_V3_unfiltered_cleaned_split.json --profile
  • 测试结果
Starting profiler...
Traffic request rate: inf
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:43<00:00,  1.17it/s]Stopping profiler...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:43<00:00,  2.48it/s]
============ Serving Benchmark Result ============
Successful requests:                     1000      
Benchmark duration (s):                  403.73    
Total input tokens:                      217393    
Total generated tokens:                  198567    
Request throughput (req/s):              2.48      
Output token throughput (tok/s):         491.83    
Total Token throughput (tok/s):          1030.30   
---------------Time to First Token----------------
Mean TTFT (ms):                          145208.34 
Median TTFT (ms):                        135880.49 
P99 TTFT (ms):                           333073.43 
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          576.98    
Median TPOT (ms):                        480.20    
P99 TPOT (ms):                           3010.28   
---------------Inter-token Latency----------------
Mean ITL (ms):                           440.17    
Median ITL (ms):                         291.82    
P99 ITL (ms):                            2020.04   
==================================================

六轮测试(enable-8192)

  • 启动参数
docker run --runtime nvidia --gpus all \-v /data1/data_vllm:/data \-p 8001:8000 \-e VLLM_TORCH_PROFILER_DIR=/data/mnt/traces/ \--name qwen_llm_3 \--ipc=host \swr.cn-east-3.myhuaweicloud.com/kubesre/docker.io/vllm/vllm-openai \--model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 \--max-model-len 98832 \--max-num-batched-tokens 8192python3 vllm/benchmarks/benchmark_serving.py --backend vllm --model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 --dataset ShareGPT_V3_unfiltered_cleaned_split.json --profile
  • 测试结果
Starting profiler...
Traffic request rate: inf
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:43<00:00,  1.58it/s]Stopping profiler...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:43<00:00,  2.48it/s]
============ Serving Benchmark Result ============
Successful requests:                     1000      
Benchmark duration (s):                  403.80    
Total input tokens:                      217393    
Total generated tokens:                  198695    
Request throughput (req/s):              2.48      
Output token throughput (tok/s):         492.07    
Total Token throughput (tok/s):          1030.44   
---------------Time to First Token----------------
Mean TTFT (ms):                          145191.92 
Median TTFT (ms):                        137176.88 
P99 TTFT (ms):                           333630.23 
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          590.15    
Median TPOT (ms):                        482.05    
P99 TPOT (ms):                           3091.14   
---------------Inter-token Latency----------------
Mean ITL (ms):                           439.71    
Median ITL (ms):                         290.74    
P99 ITL (ms):                            1798.01   
==================================================

在启用 chunked-prefill 的情况下,max-num-batched-tokens 越小,TTFT 越长,ITL 越短;max-num-batched-tokens 越大,TTFT 越短,ITL 越长。

七轮测试(disable-256)

  • 启动参数
docker run --runtime nvidia --gpus all \-v /data1/data_vllm:/data \-p 8001:8000 \-e VLLM_TORCH_PROFILER_DIR=/data/mnt/traces/ \--name qwen_llm_3 \--ipc=host \swr.cn-east-3.myhuaweicloud.com/kubesre/docker.io/vllm/vllm-openai \--model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 \--max-model-len 256 \--max-num-batched-tokens 256 \--enable-chunked-prefill falsepython3 vllm/benchmarks/benchmark_serving.py --backend vllm --model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 --dataset ShareGPT_V3_unfiltered_cleaned_split.json --profile
  • 测试结果
Starting profiler...
Traffic request rate: inf
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌| 998/1000 [00:48<00:00, 15.69it/s]Stopping profiler...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [00:48<00:00, 20.63it/s]
============ Serving Benchmark Result ============
Successful requests:                     296       
Benchmark duration (s):                  48.48     
Total input tokens:                      14909     
Total generated tokens:                  29120     
Request throughput (req/s):              6.11      
Output token throughput (tok/s):         600.72    
Total Token throughput (tok/s):          908.27    
---------------Time to First Token----------------
Mean TTFT (ms):                          8354.34   
Median TTFT (ms):                        7792.90   
P99 TTFT (ms):                           18643.59  
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          409.28    
Median TPOT (ms):                        272.91    
P99 TPOT (ms):                           1815.86   
---------------Inter-token Latency----------------
Mean ITL (ms):                           246.95    
Median ITL (ms):                         175.46    
P99 ITL (ms):                            580.31    
==================================================

八轮测试(disable-512)

  • 启动参数
docker run --runtime nvidia --gpus all \-v /data1/data_vllm:/data \-p 8001:8000 \-e VLLM_TORCH_PROFILER_DIR=/data/mnt/traces/ \--name qwen_llm_3 \--ipc=host \swr.cn-east-3.myhuaweicloud.com/kubesre/docker.io/vllm/vllm-openai \--model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 \--max-model-len 512 \--max-num-batched-tokens 512 \--enable-chunked-prefill falsepython3 vllm/benchmarks/benchmark_serving.py --backend vllm --model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 --dataset ShareGPT_V3_unfiltered_cleaned_split.json --profile
  • 测试结果
Starting profiler...
Traffic request rate: inf
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [03:14<00:00,  1.15it/s]Stopping profiler...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [03:14<00:00,  5.15it/s]
============ Serving Benchmark Result ============
Successful requests:                     700       
Benchmark duration (s):                  194.36    
Total input tokens:                      82224     
Total generated tokens:                  108536    
Request throughput (req/s):              3.60      
Output token throughput (tok/s):         558.42    
Total Token throughput (tok/s):          981.47    
---------------Time to First Token----------------
Mean TTFT (ms):                          59907.26  
Median TTFT (ms):                        43205.72  
P99 TTFT (ms):                           149116.64 
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          527.19    
Median TPOT (ms):                        401.10    
P99 TPOT (ms):                           2689.25   
---------------Inter-token Latency----------------
Mean ITL (ms):                           372.15    
Median ITL (ms):                         290.96    
P99 ITL (ms):                            987.35    
==================================================

九轮测试(disable-2048)

  • 启动参数
docker run --runtime nvidia --gpus all \-v /data1/data_vllm:/data \-p 8001:8000 \-e VLLM_TORCH_PROFILER_DIR=/data/mnt/traces/ \--name qwen_llm_3 \--ipc=host \swr.cn-east-3.myhuaweicloud.com/kubesre/docker.io/vllm/vllm-openai \--model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 \--max-model-len 2048 \--max-num-batched-tokens 2048 \--enable-chunked-prefill falsepython3 vllm/benchmarks/benchmark_serving.py --backend vllm --model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 --dataset ShareGPT_V3_unfiltered_cleaned_split.json --profile
  • 测试结果
Starting profiler...
Traffic request rate: inf
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:43<00:00,  2.38it/s]Stopping profiler...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:43<00:00,  2.48it/s]
============ Serving Benchmark Result ============
Successful requests:                     1000      
Benchmark duration (s):                  403.04    
Total input tokens:                      217393    
Total generated tokens:                  198690    
Request throughput (req/s):              2.48      
Output token throughput (tok/s):         492.98    
Total Token throughput (tok/s):          1032.36   
---------------Time to First Token----------------
Mean TTFT (ms):                          142571.62 
Median TTFT (ms):                        135323.01 
P99 TTFT (ms):                           333148.28 
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          668.80    
Median TPOT (ms):                        472.08    
P99 TPOT (ms):                           5647.73   
---------------Inter-token Latency----------------
Mean ITL (ms):                           446.03    
Median ITL (ms):                         305.97    
P99 ITL (ms):                            1420.74   
==================================================

十轮测试(disable-4096)

  • 启动参数
docker run --runtime nvidia --gpus all \-v /data1/data_vllm:/data \-p 8001:8000 \-e VLLM_TORCH_PROFILER_DIR=/data/mnt/traces/ \--name qwen_llm_3 \--ipc=host \swr.cn-east-3.myhuaweicloud.com/kubesre/docker.io/vllm/vllm-openai \--model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 \--max-model-len 4096 \--max-num-batched-tokens 4096 \--enable-chunked-prefill falsepython3 vllm/benchmarks/benchmark_serving.py --backend vllm --model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 --dataset ShareGPT_V3_unfiltered_cleaned_split.json --profile
  • 测试结果
Starting profiler...
Traffic request rate: inf
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:44<00:00,  1.62it/s]Stopping profiler...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:44<00:00,  2.47it/s]
============ Serving Benchmark Result ============
Successful requests:                     1000      
Benchmark duration (s):                  404.60    
Total input tokens:                      217393    
Total generated tokens:                  198856    
Request throughput (req/s):              2.47      
Output token throughput (tok/s):         491.48    
Total Token throughput (tok/s):          1028.78   
---------------Time to First Token----------------
Mean TTFT (ms):                          145568.89 
Median TTFT (ms):                        138366.82 
P99 TTFT (ms):                           333544.04 
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          612.43    
Median TPOT (ms):                        478.76    
P99 TPOT (ms):                           3506.11   
---------------Inter-token Latency----------------
Mean ITL (ms):                           444.17    
Median ITL (ms):                         305.46    
P99 ITL (ms):                            1451.10   
==================================================

十一轮测试(disable-8192)

  • 启动参数
docker run --runtime nvidia --gpus all \-v /data1/data_vllm:/data \-p 8001:8000 \-e VLLM_TORCH_PROFILER_DIR=/data/mnt/traces/ \--name qwen_llm_3 \--ipc=host \swr.cn-east-3.myhuaweicloud.com/kubesre/docker.io/vllm/vllm-openai \--model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 \--max-model-len 8192 \--max-num-batched-tokens 8192 \--enable-chunked-prefill falsepython3 vllm/benchmarks/benchmark_serving.py --backend vllm --model /data/Qwen2.5-72B-Instruct-GPTQ-Int4 --dataset ShareGPT_V3_unfiltered_cleaned_split.json --profile
  • 测试结果
Starting profiler...
Traffic request rate: inf
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:44<00:00,  1.20it/s]Stopping profiler...
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1000/1000 [06:44<00:00,  2.47it/s]
============ Serving Benchmark Result ============
Successful requests:                     1000      
Benchmark duration (s):                  404.37    
Total input tokens:                      217393    
Total generated tokens:                  198400    
Request throughput (req/s):              2.47      
Output token throughput (tok/s):         490.64    
Total Token throughput (tok/s):          1028.26   
---------------Time to First Token----------------
Mean TTFT (ms):                          145157.15 
Median TTFT (ms):                        138322.92 
P99 TTFT (ms):                           331883.14 
-----Time per Output Token (excl. 1st token)------
Mean TPOT (ms):                          609.64    
Median TPOT (ms):                        477.62    
P99 TPOT (ms):                           3823.35   
---------------Inter-token Latency----------------
Mean ITL (ms):                           443.97    
Median ITL (ms):                         303.46    
P99 ITL (ms):                            1575.09   
==================================================

在不启用 chunked-prefill 的情况下,七八轮显示部分失败了,失败原因是超过上下文限制

数据可视化

数据汇总说明

说明1:横轴命名规则为 [序号]-[–enable-chunked-prefill]-[–max-num-batched-tokens],其中序号便于排序,例如:0-enable-64 表示第 0 轮测试,启用 chunked-prefill,max-num-batched-tokens 设置为 64
说明2:以下数据分析均基于本次测试数据集,场景更多类似于日常对话,本次的调优分析并不适合直播数据分析场景
说明3:第七、八轮数据存在因上下文长度超出最大设置长度导致请求失败的情况,数据失真,不在以下仪表板呈现

总览-耗时&吞吐量

1

这里包含了整个测试集的总耗时,输出 token 吞吐量,总(输出+输入) token 吞吐量
除了开启 --enable-chunked-prefill 且 --max-num-batched-tokens 设置较小时会影响总耗时,其他情况几乎无差别,–max-num-batched-tokens 设置越小,触发 chunked-prefill 情况越多,prefill 耗时大于 decode 阶段带来的耗时收益,导致总耗时变长

TTFT(Time To First Token)

2
该指标表示的是第一个 token 生成时间,也即 prefill 阶段的总耗时

  • 启用 --enable-chunked-prefill
    • –max-num-batched-tokens < 512 时,值越大,prefill 耗时越长
    • –max-num-batched-tokens >= 512 之后,prefill 耗时相差不大,应该和测试数据集有关系,长文本的请求较少,触发chunked-prefill 的序列就少
  • 不启用 --enable-chunked-prefill
    • 设置的 --max-num-batched-tokens <= 512 时,数值越小失败请求越多,失败原因是上下文长度超过设置的最大上下文长度(折线图未体现,看原始数据)
    • 设置的 --max-num-batched-tokens >= 2048 时,prefill 耗时几乎一致

TPOT(Time per Output Token)

3
该指标反映的是 decode 阶段输出每个 token 的时间,它衡量的是模型生成 token 的整体速度,不考虑 token 生成的顺序

  • 启用 --enable-chunked-prefill
    • 可以看到这个指标基本上和 TTFT 相反,–max-num-batched-tokens 越短,就越快将序列送去 decode,耗时就越短

ITL(Inter-token Latency)

4
该指标反映的是 decode 阶段 token 连续输出的耗时,它专注于衡量模型生成 token 的流式特性,即一个 token 生成后,下一个 Token 生成前的等待时间。

  • 都是 decode 阶段,它和 TPOT 走势是一致的

结论

  1. 首先声明,测试数据集对测试情况影响会比较大,该测试集为官方提供的 1000 例无长文本(上下文基本在 512内)的测试集,生产调优需要根据场景进行重新分析
  2. –enable-chunked-prefill 如果开启,–max-num-batched-tokens 的大小设置会影响总耗时和吞吐量
    • 如果设置的过小,比如 --max-num-batched-tokens < 256 时,该值越小耗时越长
    • 如果设置 --max-num-batched-tokens >= 256 时,耗时和吞吐量几乎无影响
  3. 相比总耗时和吞吐量,–enable-chunked-prefill 如果开启,–max-num-batched-tokens 的大小设置对 prefill 和 decode 两阶段耗时影响较大
    • –max-num-batched-tokens设置越大 prefill 阶段耗时越短,decode 阶段耗时越长;相反值越小,decode 阶段耗时越短,prefill 阶段耗时越长
    • 但 --max-num-batched-tokens 超过一定值时(本测试集超过 2048 时),两者几乎无波动
  4. –enable-chunked-prefill 如果未开启,请求上下文长度会受限于 --max-num-batched-tokens 的设置,如果值设置的较小,则上下文大于该值的请求将会请求失败
  5. 测试过程中其他结论
    • –max-num-batched-tokens 设置的值需要大于模型上下文长度–max-model-len
    • –max-num-batched-tokens 需要大于 batched 的序列(请求)数量–max-num-seqs
    • –max-num-batched-tokens 的设置还会受到机器可用显存(乘以 --gpu-memory-utilization)限制,因为 KV-Cache 大概需要占用的最大显存大小公式如下:
    KV_cache_size = 2 * n_layers * n_heads * seq_length * d_head * precision * batch_size这个公式是用来估算 Transformer 模型中 KV 缓存大小的。下面是公式中每个参数的详细解释:2:这个系数是因为每个注意力头都有两个张量需要被缓存:键(Key)和值(Value)张量。所以,对于每个头,我们都需要存储两个张量的内存。
    n_layers:模型中注意力层的总数。在 Transformer 模型中,每个编码器或解码器块通常包含一个自注意力层,所以这个数字通常等于模型的块数。
    n_heads:每个注意力层中注意力头的数量。在多头自注意力(Multi-Head Attention)机制中,模型会将注意力机制分割成多个“头”,每个头学习序列的不同部分。
    seq_length:序列的最大长度。这是模型在单次推理中可以处理的输入序列的最大长度,包括提示(prompt)和生成的补全部分(completion)。
    d_head:每个注意力头的隐藏维度。这是每个头中键和值张量的维度大小。
    precision:数据的精度,它决定了每个参数需要多少字节来存储。常见的精度包括:
    - FP32(单精度浮点数):4字节/参数
    - FP16(半精度浮点数):2字节/参数
    - INT8(8位整数):1字节/参数
    batch_size:批处理大小,即模型一次推理中同时处理的序列数量。
    
  6. 以上涉及到各参数描述
    • –max-model-len:默认无值,会取模型配置文件里的最大上下文配置
    • –enable-chunked-prefill:默认不开启,当 --max-model-len > 30k 时,自动开启
    • –max-num-batched-tokens:默认值 512
    • –max-num-seqs:默认值 256
    • –gpu-memory-utilization:默认 0.9;这个参数指定了模型在启动时应该预分配多少百分比的 GPU 内存。增加这个值可以提供更多的内存给模型的 KV 缓存(关键值缓存),有助于提高模型处理大型输入或批量请求的能力。

文章转载自:
http://dinncospatuliform.ydfr.cn
http://dinncoergotize.ydfr.cn
http://dinncopauperize.ydfr.cn
http://dinncoctt.ydfr.cn
http://dinncoswound.ydfr.cn
http://dinncospeel.ydfr.cn
http://dinncobicorporeal.ydfr.cn
http://dinncopiagetian.ydfr.cn
http://dinncointensive.ydfr.cn
http://dinncocowhage.ydfr.cn
http://dinncosubcategory.ydfr.cn
http://dinncoespecially.ydfr.cn
http://dinncointerdigitate.ydfr.cn
http://dinncoperilous.ydfr.cn
http://dinncohydrazide.ydfr.cn
http://dinncobioactive.ydfr.cn
http://dinncoquaver.ydfr.cn
http://dinncoshane.ydfr.cn
http://dinncoanomaly.ydfr.cn
http://dinncocoliform.ydfr.cn
http://dinncocircumrenal.ydfr.cn
http://dinncounsteady.ydfr.cn
http://dinncohexosan.ydfr.cn
http://dinncoindefensible.ydfr.cn
http://dinncotowpath.ydfr.cn
http://dinncospelunk.ydfr.cn
http://dinncosaghalien.ydfr.cn
http://dinncosweetsop.ydfr.cn
http://dinncomalate.ydfr.cn
http://dinncorallye.ydfr.cn
http://dinncogilbert.ydfr.cn
http://dinncoantienzymic.ydfr.cn
http://dinncokirtle.ydfr.cn
http://dinncomedalet.ydfr.cn
http://dinncogrundyism.ydfr.cn
http://dinncoinertially.ydfr.cn
http://dinncomagisterium.ydfr.cn
http://dinncovortically.ydfr.cn
http://dinncomischmetall.ydfr.cn
http://dinncointravehicular.ydfr.cn
http://dinncosmitty.ydfr.cn
http://dinncosnowbush.ydfr.cn
http://dinncoinamorata.ydfr.cn
http://dinncoqualificator.ydfr.cn
http://dinncocrazily.ydfr.cn
http://dinncofragmentize.ydfr.cn
http://dinncoimmelmann.ydfr.cn
http://dinncoillude.ydfr.cn
http://dinncosnakelet.ydfr.cn
http://dinncodeclinatory.ydfr.cn
http://dinncounacknowledged.ydfr.cn
http://dinncoabut.ydfr.cn
http://dinncoaweather.ydfr.cn
http://dinncoeuhominid.ydfr.cn
http://dinncoeelfare.ydfr.cn
http://dinncorooftree.ydfr.cn
http://dinncovp.ydfr.cn
http://dinncomoisher.ydfr.cn
http://dinncophotoperiod.ydfr.cn
http://dinncochordophone.ydfr.cn
http://dinncooveremphasize.ydfr.cn
http://dinncosodalite.ydfr.cn
http://dinncoindictment.ydfr.cn
http://dinncosurgicenter.ydfr.cn
http://dinncovollyball.ydfr.cn
http://dinncocoalbox.ydfr.cn
http://dinncogeriatrician.ydfr.cn
http://dinncoasterid.ydfr.cn
http://dinncodrover.ydfr.cn
http://dinncospiritualize.ydfr.cn
http://dinncovibrotactile.ydfr.cn
http://dinncocountertendency.ydfr.cn
http://dinncoquartern.ydfr.cn
http://dinncoparamorphine.ydfr.cn
http://dinncodecadent.ydfr.cn
http://dinncoadoptionist.ydfr.cn
http://dinncocornflakes.ydfr.cn
http://dinncoidiodynamics.ydfr.cn
http://dinnconigritude.ydfr.cn
http://dinncopincette.ydfr.cn
http://dinncopiscator.ydfr.cn
http://dinncohemopolesis.ydfr.cn
http://dinncopudding.ydfr.cn
http://dinncomutate.ydfr.cn
http://dinncoplug.ydfr.cn
http://dinncospeediness.ydfr.cn
http://dinncoeverwhich.ydfr.cn
http://dinncodramatic.ydfr.cn
http://dinncotaiwan.ydfr.cn
http://dinncocontained.ydfr.cn
http://dinncocorvine.ydfr.cn
http://dinncological.ydfr.cn
http://dinncoelectroshock.ydfr.cn
http://dinncoagazed.ydfr.cn
http://dinncovulcanian.ydfr.cn
http://dinncoshipbuilder.ydfr.cn
http://dinncoangiopathy.ydfr.cn
http://dinncodermatographia.ydfr.cn
http://dinncounsympathetic.ydfr.cn
http://dinncoomdurman.ydfr.cn
http://www.dinnco.com/news/102034.html

相关文章:

  • wordpress 翻页函数南平网站seo
  • wordpress 分类页id怎么写电脑清理优化大师
  • 徐州优化网站建设百度排行榜明星
  • 淘宝直播要先建设个网站吗搜索引擎技术包括哪些
  • wordpress管理员登录站长工具之家seo查询
  • 设计师个人网站欣赏杭州seo关键字优化
  • 电商素材网站武汉整站优化
  • 装潢设计网成都爱站网seo站长查询工具
  • 专业做网站的公司保定怎样做一个自己的网站
  • 自己做网站哪里最好快速排名优化
  • 免费医院网站源码手机网站seo免费软件
  • 旅游网站开发工程师建网站哪个平台好
  • 佛山论坛建站模板能打开各种网站的浏览器
  • 建设网站编程语言网络推广外包内容
  • 网站策划案网站优化关键词
  • 做网站要会编程么关键词搜索查询
  • 医院网站详细设计广州网站优化公司
  • 门户网站免费奖励自己长沙疫情最新情况
  • 番禺市桥网站建设中国新闻社
  • 四川省的住房和城乡建设厅网站首页排名关键词优化
  • 南宁有多少家网站建设推广的公司二级域名查询网站
  • 网站制作需要的软件成都做网络推广的公司有哪些
  • 做珠宝b2b网站有哪些网络营销软件条件
  • 网站建设作用图片优化防疫措施
  • wordpress附件下载次数限制seo一键优化
  • 可以商用的图片网站福州seo优化
  • wap网站制作教程电脑培训零基础培训班
  • 网站为什么要服务器山东服务好的seo
  • 电商网站的建设与维护业务推广网站
  • 为什么用dw做的网站打不开seo搜索引擎优化期末及答案