Skip to content

Performance check between native http module vs koa2.

Notifications You must be signed in to change notification settings

bifot/native-http-vs-koa2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 

Releases

No releases published

Packages

No packages published