-
Notifications
You must be signed in to change notification settings - Fork 375
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
Question: basic http benchmark perform bad with built-in http module and http keep-alive set #1197
Comments
This is a copy-paste of a benchmark @truemedian has done before regarding this:
(can be found on Discord here) As you can see, the way Luvit handles keep-alive seems to be causing the performance issue. |
@Bilal2453, thanks for the info, I tested nodejs with http keep-alive disabled, but it looks still much better than luvit (7k vs 3k) const http = require("http");
const server = http.createServer(function (req, res) {
res.setHeader("Connection", "Close");
res.end("Hello world!");
});
server.listen(5002); → ./go-wrk -c 125 http://127.0.0.1:5002
Running 10s test @ http://127.0.0.1:5002
125 goroutine(s) running concurrently
71000 requests in 9.988334696s, 4.81MB read
Requests/sec: 7108.29
Transfer/sec: 492.86KB
Avg Req Time: 17.585096ms
Fastest Request: 12.587222ms
Slowest Request: 126.353709ms
Number of Errors: 0 And sets |
Well @fallenwood, that is kinda weird. For myself I get the following: Nodejs with keep-alive off (your provided code):
Luvit with keep-alive off (same as your code with :setHeader added):
And coro-http with keep-alive off:
with the code: local http = require 'coro-http'
http.createServer("127.0.0.1", 5003, function(req, res)
return {{"Connection", "Close"}, code = 200, keepAlive = false}, "Hello world!"
end) With Nodejs v18.15.0, Luvit 2.18.1, on the following machine
I tried with 125 thread + 125 connection and similar results, could this perhaps be related to your wrk implementation? |
@Bilal2453 here is the result with
with local http = require("http")
local server = http.createServer(function (req, res)
res:setHeader('Connection', 'close')
res:finish("Hello world!")
end)
server:listen(5004)
I'll try c-wrk later |
summary of c-wrk results (installed with nix)
|
I think it's ok to answer my questions, thanks for your help :) |
I think it is worth keeping this issue, or at least one issue referencing this, up. It is definitely something that needs to be solved. Would be really nice if you re-open this, and change the title to indicate the problem, being terrible with keep-alive requests. Luvit is in fact doing something wrong here, don't currently have the time to dig into it but will serve as a reminder. |
I am testing the performance of luvit with the basic usage of http module comparing with nodejs, on Linux amd64, and the performance looks pretty bad
the QPS of luvit is 3k, while nodejs is 28k
the source codes are
the runtime infos are
The text was updated successfully, but these errors were encountered: