Skip to content
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

perf(ext/http): save event loop tick for sync responses #26357

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

littledivy
Copy link
Member

@littledivy littledivy commented Oct 17, 2024

main under heavy load:

[    13.448] op_http_try_wait                                   : Dispatched Fast
[    13.448] op_http_try_wait                                   : Completed Fast
[    13.448] op_http_try_wait                                   : Dispatched Fast
[    13.448] op_http_try_wait                                   : Completed Fast
[    13.449] op_http_wait                                       : Dispatched Async
[    13.449] op_http_set_response_header                        : Dispatched Fast
[    13.449] op_http_set_response_header                        : Completed Fast
[    13.449] op_http_set_response_body_text                     : Dispatched Fast
[    13.449] op_http_set_response_body_text                     : Completed Fast
[    13.449] op_http_set_response_header                        : Dispatched Fast
[    13.449] op_http_set_response_header                        : Completed Fast
[    13.449] op_http_set_response_body_text                     : Dispatched Fast
[    13.449] op_http_set_response_body_text                     : Completed Fast

this patch under heavy load:

[     6.201] op_http_try_wait                                   : Dispatched Fast
[     6.201] op_http_try_wait                                   : Completed Fast
[     6.201] op_http_set_response_header                        : Dispatched Fast
[     6.201] op_http_set_response_header                        : Completed Fast
[     6.201] op_http_set_response_body_text                     : Dispatched Fast
[     6.201] op_http_set_response_body_text                     : Completed Fast
[     6.202] op_http_try_wait                                   : Dispatched Fast
[     6.202] op_http_try_wait                                   : Completed Fast
[     6.202] op_http_set_response_header                        : Dispatched Fast
[     6.202] op_http_set_response_header                        : Completed Fast
[     6.202] op_http_set_response_body_text                     : Dispatched Fast
[     6.202] op_http_set_response_body_text                     : Completed Fast
[     6.202] op_http_try_wait                                   : Dispatched Fast
[     6.202] op_http_try_wait                                   : Completed Fast

Small bump in throughput on Linux (+3-5k rps)

request,
new ServeHandlerInfo(innerRequest),
);

if (typeof response === "object" && ReflectHas(response, "then")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a null check here? Calling Reflect.has(null, "then") will throw, but not sure how strict we are in ensuring that the callback cannot return null prior to here.

Suggested change
if (typeof response === "object" && ReflectHas(response, "then")) {
if (response !== null && typeof response === "object" && ReflectHas(response, "then")) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants