Skip to content

Conversation

kt3k
Copy link
Member

@kt3k kt3k commented Apr 28, 2025

Continued from #29069

This PR improves the http server performance of node:http by lazily bind to abort signal of Response object.

main: 50.32k RPS
this PR: 85.83k PRS

server script used:

import http from "node:http";
const server = http.createServer((req, res) => {
  res.end("hi");
});
server.listen(3000, () => console.log("listening"));

wrk command:

wrk -t12 -c400 -d10s http://localhost:3000

related #28601

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM, nice improvement

this.#request = opts.request;
}

bindToAbortSignal() {
Copy link
Member

Choose a reason for hiding this comment

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

maybe make this a private method, this interface is supposed to sort of mirror node's socket interface

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed this to symbol named function. I'm aware that is not completely private, but because this is called from the outside of the class, I guess this can't be private

@kt3k kt3k merged commit d1f7969 into denoland:main Apr 29, 2025
18 checks passed
@kt3k kt3k deleted the perf-ext-node-improve-http-server branch April 29, 2025 11:44
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.

3 participants