-
Notifications
You must be signed in to change notification settings - Fork 301
feat: replace gunicorn with hypercorn for http2 (h2c) support #1211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,7 +10,7 @@ | |||||||||
| from .embed_cache.manager import start_cache_manager | ||||||||||
| from lightllm.utils.log_utils import init_logger | ||||||||||
| from lightllm.utils.envs_utils import set_env_start_args, set_unique_server_name, get_unique_server_name | ||||||||||
| from lightllm.utils.envs_utils import get_lightllm_gunicorn_time_out_seconds, get_lightllm_gunicorn_keep_alive | ||||||||||
| from lightllm.utils.envs_utils import get_lightllm_gunicorn_keep_alive | ||||||||||
| from .detokenization.manager import start_detokenization_process | ||||||||||
| from .router.manager import start_router_process | ||||||||||
| from lightllm.utils.process_check import is_process_active | ||||||||||
|
|
@@ -337,13 +337,11 @@ def normal_or_p_d_start(args): | |||||||||
| ], | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| # 启动 gunicorn | ||||||||||
| # 启动 Hypercorn | ||||||||||
| command = [ | ||||||||||
| "gunicorn", | ||||||||||
| "hypercorn", | ||||||||||
| "--workers", | ||||||||||
| f"{args.httpserver_workers}", | ||||||||||
| "--worker-class", | ||||||||||
| "uvicorn.workers.UvicornWorker", | ||||||||||
| "--bind", | ||||||||||
| f"{args.host}:{args.port}", | ||||||||||
| "--log-level", | ||||||||||
|
|
@@ -353,8 +351,6 @@ def normal_or_p_d_start(args): | |||||||||
| "--error-logfile", | ||||||||||
| "-", | ||||||||||
| "lightllm.server.api_http:app", | ||||||||||
| "--timeout", | ||||||||||
| f"{get_lightllm_gunicorn_time_out_seconds()}", | ||||||||||
| "--keep-alive", | ||||||||||
| f"{get_lightllm_gunicorn_keep_alive()}", | ||||||||||
| ] | ||||||||||
|
|
@@ -407,11 +403,9 @@ def pd_master_start(args): | |||||||||
| ) | ||||||||||
|
|
||||||||||
| command = [ | ||||||||||
| "gunicorn", | ||||||||||
| "hypercorn", | ||||||||||
| "--workers", | ||||||||||
| "1", | ||||||||||
| "--worker-class", | ||||||||||
| "uvicorn.workers.UvicornWorker", | ||||||||||
| "--bind", | ||||||||||
| f"{args.host}:{args.port}", | ||||||||||
| "--log-level", | ||||||||||
|
|
@@ -422,8 +416,6 @@ def pd_master_start(args): | |||||||||
| "-", | ||||||||||
| "--preload", | ||||||||||
| "lightllm.server.api_http:app", | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hypercorn's default worker timeout is 30 seconds, which is significantly lower than the previous Gunicorn timeout of 180 seconds. This could cause issues with long-running requests. It's advisable to explicitly set the worker timeout to maintain similar behavior. I'd recommend making this value configurable, for example by re-introducing a function like the removed
Suggested change
|
||||||||||
| "--timeout", | ||||||||||
| f"{get_lightllm_gunicorn_time_out_seconds()}", | ||||||||||
| "--keep-alive", | ||||||||||
| f"{get_lightllm_gunicorn_keep_alive()}", | ||||||||||
| ] | ||||||||||
|
|
@@ -449,11 +441,9 @@ def config_server_start(args): | |||||||||
| set_env_start_args(args) | ||||||||||
|
|
||||||||||
| command = [ | ||||||||||
| "gunicorn", | ||||||||||
| "hypercorn", | ||||||||||
| "--workers", | ||||||||||
| "1", | ||||||||||
| "--worker-class", | ||||||||||
| "uvicorn.workers.UvicornWorker", | ||||||||||
| "--bind", | ||||||||||
| f"{args.config_server_host}:{args.config_server_port}", | ||||||||||
| "--log-level", | ||||||||||
|
|
@@ -464,8 +454,6 @@ def config_server_start(args): | |||||||||
| "-", | ||||||||||
| "--preload", | ||||||||||
| "lightllm.server.config_server.api_http:app", | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hypercorn's default worker timeout is 30 seconds, which is significantly lower than the previous Gunicorn timeout of 180 seconds. This could cause issues with long-running requests. It's advisable to explicitly set the worker timeout to maintain similar behavior. I'd recommend making this value configurable, for example by re-introducing a function like the removed
Suggested change
|
||||||||||
| "--timeout", | ||||||||||
| f"{get_lightllm_gunicorn_time_out_seconds()}", | ||||||||||
| "--keep-alive", | ||||||||||
| f"{get_lightllm_gunicorn_keep_alive()}", | ||||||||||
| ] | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hypercorn's default worker timeout is 30 seconds, which is significantly lower than the previous Gunicorn timeout of 180 seconds. This could cause issues with long-running requests. It's advisable to explicitly set the worker timeout to maintain similar behavior. I'd recommend making this value configurable, for example by re-introducing a function like the removed
get_lightllm_gunicorn_time_out_secondsbut for hypercorn.