bifot / native-http-vs-koa2

Performance check between native http module vs koa2.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

native-http-vs-koa2

Performance check between native http module vs koa2.

Servers

const http = require('http');

const app = http.createServer((req, res) => {
  res.end('Hello, world!');
});

app.listen(process.env.PORT);

vs

const Koa = require('koa');

const app = new Koa();

app.use((ctx) => {
  ctx.body = 'Hello, world!';
});

app.listen(process.env.PORT);

Benchmarks

$ node -v                    # v8.12.0
$ bash ./benchmarks/http.sh  # 104099 requests for 5 seconds
$ bash ./benchmarks/koa.sh   # 87970  requests for 5 seconds 

About

Performance check between native http module vs koa2.


Languages

Language:Shell 60.2%Language:JavaScript 39.8%