Helidium/Mitol

Why error benchmark When using express or kao

Opened this issue · 9 comments

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

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,

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

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

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

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

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

Did you manage to resolve the problem?

No i try difference port but still error

I try on linux sub system get same error