Environment:
- Ubuntu 16.04 LTS
- Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz
- Nim Compiler Version 0.14.3 (2016-06-17) [Linux: amd64]
- node v5.10.1
Nim code:
import asynchttpserver, asyncdispatch
var server = newAsyncHttpServer()
proc cb(req: Request) {.async.} =
await req.respond(Http200, "Hello World")
waitFor server.serve(Port(8080), cb)
Runned with:
$ nim c -r -d:release hello.nim
Results:
$ ./wrk -t4 -c200 -d30s -R100000 http://127.0.0.1:8080/
Running 30s test @ http://127.0.0.1:8080/
4 threads and 200 connections
Thread calibration: mean lat.: 729.308ms, rate sampling interval: 2648ms
Thread calibration: mean lat.: 729.280ms, rate sampling interval: 2648ms
Thread calibration: mean lat.: 729.579ms, rate sampling interval: 2648ms
Thread calibration: mean lat.: 729.553ms, rate sampling interval: 2648ms
Thread Stats Avg Stdev Max +/- Stdev
Latency 2.84s 768.85ms 4.16s 57.52%
Req/Sec 21.59k 141.79 21.77k 64.29%
2571660 requests in 30.00s, 122.63MB read
Requests/sec: 85724.10
Transfer/sec: 4.09MB
Nodejs code:
var http = require('http');
var server = http.createServer(function (request, response) {
response.end("Hello World\n");
});
server.listen(8000);
Runned with:
$ node hello.js
$ ./wrk -t4 -c200 -d30s -R100000 http://127.0.0.1:8000/
Running 30s test @ http://127.0.0.1:8000/
4 threads and 200 connections
Thread calibration: mean lat.: 3769.548ms, rate sampling interval: 13410ms
Thread calibration: mean lat.: 3768.957ms, rate sampling interval: 13410ms
Thread calibration: mean lat.: 3769.025ms, rate sampling interval: 13410ms
Thread calibration: mean lat.: 3769.891ms, rate sampling interval: 13410ms
Thread Stats Avg Stdev Max +/- Stdev
Latency 14.73s 4.17s 21.97s 57.68%
Req/Sec 6.68k 1.73 6.68k 75.00%
799318 requests in 30.00s, 85.38MB read
Requests/sec: 26644.06
Transfer/sec: 2.85MB