-
Notifications
You must be signed in to change notification settings - Fork 299
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
Conversation
Summary of ChangesHello @ChieloNewctle, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request updates the project's HTTP server infrastructure by replacing Gunicorn with Hypercorn. This change is crucial for enabling HTTP/2 (h2c) support, which can lead to improved performance and efficiency in handling web requests. Additionally, the update includes a refinement in process management to accurately identify and exclude internal system processes, ensuring more robust and reliable application behavior. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request replaces gunicorn with hypercorn to add support for HTTP/2. The changes primarily involve updating server startup commands in lightllm/server/api_start.py and modifying dependencies in requirements.txt. While the core change is sound, I've identified a critical issue where a deleted utility function for timeout configuration is still being called in two places. This would cause the server to fail at startup. I've provided suggestions to remove these calls, which aligns with how the timeout was handled in other parts of the same file. Other changes, such as filtering out a new process type spawned by hypercorn, appear correct and necessary.
lightllm/server/api_start.py
Outdated
| "--read-timeout", | ||
| f"{get_lightllm_gunicorn_time_out_seconds()}", |
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.
The function get_lightllm_gunicorn_time_out_seconds called on line 355 has been removed in lightllm/utils/envs_utils.py, but it's still being called here. This will cause a NameError at runtime. The timeout configuration was removed for pd_master_start, so it should probably be removed here as well for consistency.
lightllm/server/api_start.py
Outdated
| "--read-timeout", | ||
| f"{get_lightllm_gunicorn_time_out_seconds()}", |
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.
The function get_lightllm_gunicorn_time_out_seconds called on line 460 has been removed in lightllm/utils/envs_utils.py, but it's still being called here. This will cause a NameError at runtime. The timeout configuration was removed for pd_master_start, so it should probably be removed here as well for consistency.
73d920f to
d213746
Compare
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.
Code Review
This pull request replaces Gunicorn with Hypercorn to enable HTTP/2 support, which is a great enhancement. The changes correctly update the server startup commands and dependencies. My main feedback revolves around the worker timeout configuration. The previous explicit timeout setting was removed, which causes the server to fall back to Hypercorn's much shorter default timeout. This could potentially lead to issues with long-running requests. I've provided suggestions to reintroduce a configurable worker timeout to ensure consistent behavior.
| @@ -353,8 +351,6 @@ def normal_or_p_d_start(args): | |||
| "--error-logfile", | |||
| "-", | |||
| "lightllm.server.api_http:app", | |||
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_seconds but for hypercorn.
| "lightllm.server.api_http:app", | |
| "lightllm.server.api_http:app", | |
| "--worker-timeout", | |
| "180", |
| @@ -422,8 +416,6 @@ def pd_master_start(args): | |||
| "-", | |||
| "--preload", | |||
| "lightllm.server.api_http:app", | |||
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_seconds but for hypercorn.
| "lightllm.server.api_http:app", | |
| "lightllm.server.api_http:app", | |
| "--worker-timeout", | |
| "180", |
| @@ -464,8 +454,6 @@ def config_server_start(args): | |||
| "-", | |||
| "--preload", | |||
| "lightllm.server.config_server.api_http:app", | |||
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_seconds but for hypercorn.
| "lightllm.server.config_server.api_http:app", | |
| "lightllm.server.config_server.api_http:app", | |
| "--worker-timeout", | |
| "180", |
Based on #1150.