Helidium / Mitol

Lightweight NodeJS http server
Other
175 stars 5 forks source link

Why error benchmark When using express or kao #14

Open 7elven opened 6 years ago

7elven commented 6 years ago

express.js `const express = require('express'); const app = express() const http = require('mitol');

app.get('/', (req, res) => { res.send('Hello World!'); });

http.createServer(app).listen(3000, () => { console.log('Example app listening on port 3000!'); });`

kao.js `const mitol = require('mitol'); const Koa = require('koa'); const app = new Koa();

// response app.use(ctx => { ctx.status = 200; ctx.body = 'Hello World!'; });

mitol.createServer(app.callback()).listen(3000);`

wrk -t12 -c400 -d3s http://127.0.0.1:3000/

Running 3s test @ http://127.0.0.1:3000/ 12 threads and 400 connections Thread Stats Avg Stdev Max +/- Stdev Latency 0.00us 0.00us 0.00us -nan% Req/Sec 0.00 0.00 0.00 -nan% 0 requests in 3.10s, 0.00B read Socket errors: connect 0, read 15897, write 0, timeout 0 Requests/sec: 0.00 Transfer/sec: 0.00B

Helidium commented 6 years ago

That is very strange indeed.

My results are following: wrk -t12 -c400 -d3s http://127.0.0.1:3000/ Running 3s test @ http://127.0.0.1:3000/ 12 threads and 400 connections Thread Stats Avg Stdev Max +/- Stdev Latency 29.01ms 86.46ms 908.70ms 94.53% Req/Sec 2.87k 1.31k 6.20k 73.03% 94536 requests in 3.10s, 22.63MB read Requests/sec: 30498.05 Transfer/sec: 7.30MB

Can you please post some details about your test system. Thank you,

7elven commented 6 years ago

my development in digitalocean 2 cpu, 2GB ram, ubuntu 16, wrk last version, node v.8

i don't know why error when test but it can run on browser perfectly

Helidium commented 6 years ago

Hmmm, is it possible Digital ocean is blocking so much concurrent connections, if you run regular node server, does it work?

7elven commented 6 years ago
const http = require('mitol');

let server = http.createServer((req, res) => {
    res.end('Hello World!');
});

server.listen(8080, () => {
    console.log('Example app listening on port 8080!')
});

this code can run test and this result

wrk -t12 -c400 -d3s http://127.0.0.1:3000/ Running 3s test @ http://127.0.0.1:3000/ 12 threads and 400 connections Thread Stats Avg Stdev Max +/- Stdev Latency 13.52ms 23.90ms 347.42ms 97.71% Req/Sec 2.99k 1.13k 11.23k 77.99% 108290 requests in 3.09s, 15.70MB read Requests/sec: 35099.90 Transfer/sec: 5.09MB

Helidium commented 6 years ago

this is weird, although here youre using a different port...

Helidium commented 6 years ago

I was running the code you posted without problems...

Helidium commented 6 years ago

Did you manage to resolve the problem?

7elven commented 6 years ago

No i try difference port but still error

7elven commented 6 years ago

I try on linux sub system get same error