基于容器服务(VKE)应用中心的应用模板及其指导文档进行部署应用,需要测试弹性极速缓存(EIC)实例最佳性能时,通过本文方法进行测试。
已通过 VKE 应用中心的应用模板,部署了大模型应用。详细操作,请参见 AI 云原生最佳实践。
基于 VKE 应用中心的应用模板部署完成基于 SGLang 或 Dynamo 的应用后,通过应用模版更新。
enabled
为false
,然后单击 确定 保存变更。gdkv: bitmai: pullPolicy: IfNotPresent repository: vke-pre-cn-beijing.cr.volces.com/vke/bitmai tag: v0.0.1 enabled: false # 修改为 false,停止 GDKV Server。
执行如下命令启动脚本。https://github.com/vllm-project/vllm/tree/main/benchmarks
脚本内容如下所示。bash test.sh >test.log 2>&1 &
# 定义 input 和 output 长度 OUTPUT_LEN=1500 # 创建 Logs 目录(如果不存在) model=Deepseek # 测试 GPU 和 EIC 性能时,dir 替换为模型应用相关的日志存储目录 dir=logs_vllm_Deepseek mkdir -p $dir # 定义 request-rate 和 max-concurrency #declare -a input_lens=(200 500 1024 2048 4096 8192 16000 32000) #declare -a request_rates=(1 16 32 48 64 80 128 160) #declare -a max_concurrency=(1 16 32 48 64 80 128 160) #declare -a num_prompts=(4 64 128 192 256 320 512 640) declare -a max_concurrency=(2 4 8 16) declare -a input_lens=(3500 3500 3500) declare -a num_prompts=(16 32 64) SEED=1 # 运行 benchmark 测试 for i in "${!input_lens[@]}"; do for j in "${!max_concurrency[@]}"; do INPUT_LEN=${input_lens[$i]} RATE=${max_concurrency[$j]} CONCURRENCY=${max_concurrency[$j]} PROMPTS=${num_prompts[$i]} SEED=$((SEED + 1)) echo "Running benchmark with input len: $INPUT_LEN, output len $OUTPUT_LEN, request rate $RATE, concurrency $CONCURRENCY, prompts $PROMPTS, first round" python3 benchmark_serving.py --backend vllm \ --tokenizer /models/deepseek \ --model $model \ --base-url http://127.0.0.1:8080 \ --endpoint /v1/completions \ --metric_percentiles '50,90,95,99' \ --goodput ttft:5000 tpot:250 \ --num-prompts $PROMPTS \ --request-rate $RATE \ --max-concurrency $CONCURRENCY \ --random-input-len $INPUT_LEN \ --random-prefix-len 0 \ --random-output-len $OUTPUT_LEN \ --dataset-name random \ --ignore-eos \ --seed $SEED \ --save-result \ --result-dir ./$dir \ >> $dir/${model}_${CONCURRENCY}_${PROMPTS}_${INPUT_LEN}_${OUTPUT_LEN}_firstround.txt 2>&1 sleep 1 echo "Running benchmark with input len: $INPUT_LEN, output len $OUTPUT_LEN, request rate $RATE, concurrency $CONCURRENCY, prompts $PROMPTS, second round" python3 benchmark_serving.py --backend vllm \ --tokenizer /models/deepseek \ --model $model \ --base-url http://127.0.0.1:8080 \ --endpoint /v1/completions \ --metric_percentiles '50,90,95,99' \ --goodput ttft:5000 tpot:250 \ --num-prompts $PROMPTS \ --request-rate $RATE \ --max-concurrency $CONCURRENCY \ --random-input-len $INPUT_LEN \ --random-prefix-len 0 \ --random-output-len $OUTPUT_LEN \ --dataset-name random \ --ignore-eos \ --seed $SEED \ --save-result \ --result-dir ./$dir \ >> $dir/${model}_${CONCURRENCY}_${PROMPTS}_${INPUT_LEN}_${OUTPUT_LEN}_secondround.txt 2>&1 sleep 1 echo "Running benchmark with input len: $INPUT_LEN, output len $OUTPUT_LEN, request rate $RATE, concurrency $CONCURRENCY, prompts $PROMPTS, finished" done done
其中GLOO_SOCKET_IFNAME=eth0 NCCL_SOCKET_IFNAME=eth0 NCCL_IB_GID_INDEX=3 NCCL_IB_DISABLE=0 python3 -m sglang.launch_server --model-path /models/deepseek --tp 16 --dist-init-addr $LWS_LEADER_ADDRESS:20000 --nnodes 2 --node-rank $LWS_WORKER_INDEX --trust-remote-code --mem-fraction-static 0.75 --enable-hierarchical-cache --enable-eic-cache --hicache-write-policy=write_back --hicache-size 1500 --page-size 16 --host 0.0.0.0 --port 8080 >server.log 2>&1 & GLOO_SOCKET_IFNAME=eth0 NCCL_SOCKET_IFNAME=eth0 NCCL_IB_GID_INDEX=3 NCCL_IB_DISABLE=0 python3 -m sglang.launch_server --model-path /models/deepseek --tp 16 --dist-init-addr $LWS_LEADER_ADDRESS:20000 --nnodes 2 --node-rank $LWS_WORKER_INDEX --trust-remote-code --mem-fraction-static 0.75 --enable-hierarchical-cache --enable-eic-cache --hicache-write-policy=write_back --hicache-size 1500 --page-size 16 >server.log 2>&1 &
--enable-hierarchical-cache --enable-eic-cache --hicache-write-policy=write_back --hicache-size 1500 --page-size 16
是启动 EIC 需要带的额外参数。在 步骤三 中单台 GPU 扩容配置的内存为 1024 GiB, 因此此处配置--hicache-size
为 1500 比较合适。GLOO_SOCKET_IFNAME=eth0 NCCL_SOCKET_IFNAME=eth0 NCCL_IB_GID_INDEX=3 NCCL_IB_DISABLE=0 python3 -m sglang.launch_server --model-path /models/deepseek --tp 16 --dist-init-addr $LWS_LEADER_ADDRESS:20000 --nnodes 2 --node-rank $LWS_WORKER_INDEX --trust-remote-code --mem-fraction-static 0.75 --page-size 16 --host 0.0.0.0 --port 8080 >server.log 2>&1 & GLOO_SOCKET_IFNAME=eth0 NCCL_SOCKET_IFNAME=eth0 NCCL_IB_GID_INDEX=3 NCCL_IB_DISABLE=0 python3 -m sglang.launch_server --model-path /models/deepseek --tp 16 --dist-init-addr $LWS_LEADER_ADDRESS:20000 --nnodes 2 --node-rank $LWS_WORKER_INDEX --trust-remote-code --mem-fraction-static 0.75 --page-size 16 >server.log 2>&1 &