mafintosh / turbo-http

Blazing fast low level http server
MIT License
1k stars 47 forks source link

Add more benchmarks #26

Closed gakada closed 3 years ago

gakada commented 5 years ago

Added restana (1st node library in the-benchmarker/web-frameworks right now), also turbo options for restana, polka, rayo, and cluster options for all benchmarks. Turbo + cluster options still require clustering support in turbo-net.

gakada commented 5 years ago

Personal results (including SO_REUSEPORT branch)

┌──────────────────────────┬────────────┬─────────┬───────────────┐
│                          │ Requests/s │ Latency │ Throughput/Mb │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ turbo-http.js            │ 193395.2   │ 0.41    │ 14.75         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ polka-turbo-cluster.js   │ 181568     │ 0.5     │ 13.65         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ turbo-http-cluster.js    │ 179468.8   │ 0.49    │ 13.55         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ polka-turbo.js           │ 176908.8   │ 0.46    │ 13.25         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ rayo-turbo-cluster.js    │ 175347.2   │ 0.51    │ 13.15         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ restana-turbo-cluster.js │ 174041.6   │ 0.52    │ 13.15         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ restana-turbo.js         │ 165132.8   │ 0.49    │ 12.25         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ express-cluster.js       │ 159142.4   │ 0.54    │ 17.50         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ rayo-turbo.js            │ 157452.8   │ 0.52    │ 11.75         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ restana-cluster.js       │ 156992     │ 0.57    │ 17.50         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ polka-cluster.js         │ 155225.6   │ 0.55    │ 17.10         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ rayo-cluster.js          │ 153561.6   │ 0.55    │ 16.90         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ bare-node-cluster.js     │ 151180.8   │ 0.57    │ 16.75         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ fastify-cluster.js       │ 149081.6   │ 0.56    │ 22.50         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ hapi-cluster.js          │ 132332.8   │ 0.67    │ 19.70         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ bare-node.js             │ 120505.6   │ 0.75    │ 13.35         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ polka.js                 │ 110585.6   │ 0.83    │ 12.35         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ rayo.js                  │ 107539.2   │ 0.86    │ 11.95         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ restana.js               │ 104889.6   │ 0.85    │ 11.65         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ fastify.js               │ 91206.4    │ 1.02    │ 13.55         │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ express.js               │ 85472      │ 1.1     │ 9.45          │
├──────────────────────────┼────────────┼─────────┼───────────────┤
│ hapi.js                  │ 51702.4    │ 1.86    │ 7.72          │
└──────────────────────────┴────────────┴─────────┴───────────────┘

Maybe autocannon is not handling some options well as with wrk I can also get something like

$ node benchmarks/compare/turbo-http.js

$ wrk -t10 -c500 -d10s http://127.0.0.1:5050/
Running 10s test @ http://127.0.0.1:5050/
  10 threads and 500 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     5.22ms    3.34ms 216.04ms   98.10%
    Req/Sec     9.45k     2.18k   60.56k    92.12%
  943474 requests in 10.10s, 71.08MB read
Requests/sec:  93420.25
Transfer/sec:      7.04MB

$ node benchmarks/compare/turbo-http-cluster.js

$ wrk -t10 -c500 -d10s http://127.0.0.1:5050/
Running 10s test @ http://127.0.0.1:5050/
  10 threads and 500 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     1.41ms    1.96ms  32.24ms   88.00%
    Req/Sec    56.80k    25.85k  146.52k    60.96%
  5668663 requests in 10.08s, 427.08MB read
Requests/sec: 562514.13
Transfer/sec:     42.38MB