You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to upgrade my project from Node v16.19.1 to Node 22.13.1, before upgrading I did a benchmark to measure performance changes after the upgrade (http server)
But I got a bad result. The performance of Node V22 has a significant decline compared to Node V16 (specifically referring to http scenarios)
Below is the environment and results of my test. I hope you can get your answers. Thank you.
Docker run node v22.13.1 alpine(3.20) on centos7(8cpu 16G)
Docker run node v16.19.1 alpine(3.12) on centos7(8cpu 16G)
Docker run script (The contents in the docker image are basically the same)
docker run --name=node-v22 --rm -it -p 30255:3000 dockerhub.xx/node:22.13.1 /bin/ash
docker run --name=node-v16 --rm -it -p 30256:3000 dockerhub.xx/node:16.19.1 /bin/ash
create app.js content
consthttp=require('http');// create HTTP serverconstserver=http.createServer((req,res)=>{// set response headerres.writeHead(200,{'Content-Type': 'text/plain'});// send "Hello World" to clientres.end('Hello World');});// listen 3000 portserver.listen(3000,()=>{console.log('Server running at http://localhost:3000/');});
run
node app.js
Throughput testing using abtest.
# n = 1000 or 2000
ab -n 100000 -c n http://localhost:30256/
# n = 1000 or 2000
ab -n 100000 -c n http://localhost:30255/
Test Result
Node V16 2000 concurrent
Server Software:
Server Hostname: localhost
Server Port: 30256
Document Path: /
Document Length: 11 bytes
Concurrency Level: 2000
Time taken for tests: 26.451 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 11200000 bytes
HTML transferred: 1100000 bytes
Requests per second: 3780.59 [#/sec] (mean)
Time per request: 529.018 [ms] (mean)
Time per request: 0.265 [ms] (mean, across all concurrent requests)
Transfer rate: 413.50 [Kbytes/sec] received
Node V22 2000 concurrent
Server Software:
Server Hostname: localhost
Server Port: 30255
Document Path: /
Document Length: 11 bytes
Concurrency Level: 2000
Time taken for tests: 51.655 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 11200000 bytes
HTML transferred: 1100000 bytes
Requests per second: 1935.93 [#/sec] (mean)
Time per request: 1033.096 [ms] (mean)
Time per request: 0.517 [ms] (mean, across all concurrent requests)
Transfer rate: 211.74 [Kbytes/sec] received
Node V16 1000 concurrent
Server Software:
Server Hostname: localhost
Server Port: 30256
Document Path: /
Document Length: 11 bytes
Concurrency Level: 1000
Time taken for tests: 23.729 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 11200000 bytes
HTML transferred: 1100000 bytes
Requests per second: 4214.23 [#/sec] (mean)
Time per request: 237.291 [ms] (mean)
Time per request: 0.237 [ms] (mean, across all concurrent requests)
Transfer rate: 460.93 [Kbytes/sec] received
Node V22 1000 concurrent
Server Software:
Server Hostname: localhost
Server Port: 30255
Document Path: /
Document Length: 11 bytes
Concurrency Level: 1000
Time taken for tests: 32.905 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 11200000 bytes
HTML transferred: 1100000 bytes
Requests per second: 3039.03 [#/sec] (mean)
Time per request: 329.052 [ms] (mean)
Time per request: 0.329 [ms] (mean, across all concurrent requests)
Transfer rate: 332.39 [Kbytes/sec] received
I've tested it many times and the results are basically the same.
Can anyone tell me the reason or a more standard test method.
From the perspective of resource consumption, the Node V22 memory usage is smaller, but the CPU has reached a peak of 100% during the test.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I want to upgrade my project from Node v16.19.1 to Node 22.13.1, before upgrading I did a benchmark to measure performance changes after the upgrade (http server)
But I got a bad result. The performance of Node V22 has a significant decline compared to Node V16 (specifically referring to http scenarios)
Below is the environment and results of my test. I hope you can get your answers. Thank you.
Docker run node v22.13.1 alpine(3.20) on centos7(8cpu 16G)
Docker run node v16.19.1 alpine(3.12) on centos7(8cpu 16G)
Docker run script (The contents in the docker image are basically the same)
create app.js content
run
Throughput testing using abtest.
# n = 1000 or 2000 ab -n 100000 -c n http://localhost:30256/
# n = 1000 or 2000 ab -n 100000 -c n http://localhost:30255/
Test Result
I've tested it many times and the results are basically the same.
Can anyone tell me the reason or a more standard test method.
From the perspective of resource consumption, the Node V22 memory usage is smaller, but the CPU has reached a peak of 100% during the test.
Thank for everyone
Beta Was this translation helpful? Give feedback.
All reactions