Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bifot/native-http-vs-koa2

Performance check between native http module vs koa2.
https://github.com/bifot/native-http-vs-koa2

api benchmarks http koa koa2 nodejs performance rest

Last synced: 22 days ago
JSON representation

Performance check between native http module vs koa2.

Awesome Lists containing this project

README

        

# native-http-vs-koa2

Performance check between native http module vs koa2.

## Servers

```js
const http = require('http');

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

app.listen(process.env.PORT);
```

vs

```js
const Koa = require('koa');

const app = new Koa();

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

app.listen(process.env.PORT);
```

## Benchmarks

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