Skip to content

[Optimization]Change default workers and max-concurrency when launch api-server#7457

Merged
Jiang-Jia-Jun merged 1 commit intoPaddlePaddle:developfrom
K11OntheBoat:develop
Apr 20, 2026
Merged

[Optimization]Change default workers and max-concurrency when launch api-server#7457
Jiang-Jia-Jun merged 1 commit intoPaddlePaddle:developfrom
K11OntheBoat:develop

Conversation

@K11OntheBoat
Copy link
Copy Markdown
Collaborator

Motivation

API-Server 启动服务时,将workers默认从1改为4,服务最大concurrency同步改为2048. 避免了GPU 运行快,但是请求不足的性能瓶颈. Blackwell架构,长输入短输出数据,512并发场景,GLM4.5-Air模型TPS提升1.74倍.
multi_api_server中这两个参数保持不变.

Modifications

API-Server 启动服务时,将workers默认从1改为4,服务最大concurrency同步改为2048.

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [[FDConfig],[APIServer],[Engine], [Scheduler], [PD Disaggregation], [Executor], [Graph Optimization], [Speculative Decoding], [RL], [Models], [Quantization], [Loader], [OP], [KVCache], [DataProcessor], [BugFix], [Docs], [CI], [Optimization], [Feature], [Benchmark], [Others], [XPU], [HPU], [GCU], [DCU], [Iluvatar], [Metax]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • Provide accuracy results.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented Apr 17, 2026

Thanks for your contribution!

@paddle-bot paddle-bot Bot added the contributor External developers label Apr 17, 2026
Copy link
Copy Markdown

@PaddlePaddle-bot PaddlePaddle-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 AI Code Review | 2026-04-17 12:15 CST

📋 Review 摘要

PR 概述:将 API-Server 的 workers 默认值从 1 调整为 4,max-concurrency 从 512 调整为 2048,以避免 GPU 运行快但请求不足的性能瓶颈;multi_api_server 模式下保持原值不变。
变更范围entrypoints/api_server.pyentrypoints/openai/utils.py
影响面 TagAPIServer

问题

级别 文件 概述
🟡 建议 openai/utils.py:344 环境变量读取方式与项目惯例不一致,建议使用 envs 模块

总体评价

变更逻辑清晰,通过环境变量 FD_ENABLE_MULTI_API_SERVER 区分单机和多机模式分别设置默认值,思路合理。建议将环境变量读取方式统一为项目已有的 envs 模块,保持代码风格一致性。



def make_arg_parser(parser: FlexibleArgumentParser) -> FlexibleArgumentParser:
_is_multi_server = os.environ.get("FD_ENABLE_MULTI_API_SERVER") == "1"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 建议 环境变量读取方式与项目惯例不一致

项目中其他地方统一使用 fastdeploy.envs 模块访问 FD_ENABLE_MULTI_API_SERVER(如 envs.FD_ENABLE_MULTI_API_SERVER),而这里直接使用 os.environ.get() 读取。虽然功能等价,但不一致的读取方式在未来维护时可能导致混淆(例如 envs 模块增加缓存或校验逻辑时,这里不会受益)。

建议改为使用已导入的 envs 模块:

_is_multi_server = envs.FD_ENABLE_MULTI_API_SERVER

注意:文件顶部已有 import fastdeploy.envs as envs(第 31 行),无需额外导入。

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@6847891). Learn more about missing BASE report.

Files with missing lines Patch % Lines
fastdeploy/entrypoints/api_server.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #7457   +/-   ##
==========================================
  Coverage           ?   73.26%           
==========================================
  Files              ?      398           
  Lines              ?    54976           
  Branches           ?     8613           
==========================================
  Hits               ?    40279           
  Misses             ?    12007           
  Partials           ?     2690           
Flag Coverage Δ
GPU 73.26% <75.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Jiang-Jia-Jun Jiang-Jia-Jun merged commit b79b094 into PaddlePaddle:develop Apr 20, 2026
76 of 84 checks passed
EmmonsCurse pushed a commit to EmmonsCurse/FastDeploy that referenced this pull request Apr 20, 2026
@EmmonsCurse
Copy link
Copy Markdown
Collaborator

✅ Cherry-pick successful! Created PR: #7516

EmmonsCurse pushed a commit to EmmonsCurse/FastDeploy that referenced this pull request Apr 20, 2026
Jiang-Jia-Jun pushed a commit that referenced this pull request Apr 24, 2026
… when launch api-server(#7457) (#7516)

* Change default workers and max-concurrency when launch api-server (#7457)

Co-authored-by: zhangxiao35 <zhangxiao35@baidu.com>

* [CI] Add --workers=1 to keep test behavior consistent with default change

---------

Co-authored-by: K11OntheBoat <ruianmaidanglao@163.com>
Co-authored-by: zhangxiao35 <zhangxiao35@baidu.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants