/api-benchmarking

Berchmarking between NODE.JS and .NET CORE

Primary LanguageC#

Autocannon Benchmarking

This is a bechmarking between NODE.JS API (EXPRESS, FASTIFY) and .NET CORE 6 API

npm install -g autocannon

Usage Node.js Projects

npm install
npm start
npm run benchmark

Usage .NET Project

dotnet build
dotnet run
autocannon -c 100 -d 30 https://localhost:7138/api/hello

Examples

.NET Core 6 API

┌─────────┬───────┬───────┬───────┬───────┬──────────┬──────────┬────────┐
│ Stat    │ 2.5%  │ 50%   │ 97.5% │ 99%   │ Avg      │ Stdev    │ Max    │
├─────────┼───────┼───────┼───────┼───────┼──────────┼──────────┼────────┤
│ Latency │ 11 ms │ 27 ms │ 45 ms │ 49 ms │ 26.66 ms │ 13.68 ms │ 655 ms │
└─────────┴───────┴───────┴───────┴───────┴──────────┴──────────┴────────┘
┌───────────┬────────┬────────┬────────┬────────┬────────┬─────────┬────────┐
│ Stat      │ 1%     │ 2.5%   │ 50%    │ 97.5%  │ Avg    │ Stdev   │ Min    │
├───────────┼────────┼────────┼────────┼────────┼────────┼─────────┼────────┤
│ Req/Sec   │ 3291   │ 3291   │ 3507   │ 4179   │ 3685   │ 322.24  │ 3290   │
├───────────┼────────┼────────┼────────┼────────┼────────┼─────────┼────────┤
│ Bytes/Sec │ 579 kB │ 579 kB │ 617 kB │ 735 kB │ 648 kB │ 56.7 kB │ 579 kB │
└───────────┴────────┴────────┴────────┴────────┴────────┴─────────┴────────┘

Req/Bytes counts sampled once per second.

111k requests in 30.07s, 19.5 MB read

Fastify

┌─────────┬──────┬──────┬───────┬──────┬─────────┬─────────┬───────┐
│ Stat    │ 2.5% │ 50%  │ 97.5% │ 99%  │ Avg     │ Stdev   │ Max   │
├─────────┼──────┼──────┼───────┼──────┼─────────┼─────────┼───────┤
│ Latency │ 1 ms │ 2 ms │ 4 ms  │ 5 ms │ 2.11 ms │ 1.04 ms │ 36 ms │
└─────────┴──────┴──────┴───────┴──────┴─────────┴─────────┴───────┘
┌───────────┬─────────┬─────────┬────────┬─────────┬──────────┬─────────┬─────────┐
│ Stat      │ 1%      │ 2.5%    │ 50%    │ 97.5%   │ Avg      │ Stdev   │ Min     │
├───────────┼─────────┼─────────┼────────┼─────────┼──────────┼─────────┼─────────┤
│ Req/Sec   │ 28991   │ 28991   │ 33151  │ 49439   │ 38928.27 │ 8026.07 │ 28979   │
├───────────┼─────────┼─────────┼────────┼─────────┼──────────┼─────────┼─────────┤
│ Bytes/Sec │ 5.42 MB │ 5.42 MB │ 6.2 MB │ 9.25 MB │ 7.28 MB  │ 1.5 MB  │ 5.42 MB │
└───────────┴─────────┴─────────┴────────┴─────────┴──────────┴─────────┴─────────┘

Req/Bytes counts sampled once per second.

1168k requests in 30.03s, 218 MB read

Express

┌─────────┬──────┬──────┬───────┬───────┬─────────┬─────────┬───────┐
│ Stat    │ 2.5% │ 50%  │ 97.5% │ 99%   │ Avg     │ Stdev   │ Max   │
├─────────┼──────┼──────┼───────┼───────┼─────────┼─────────┼───────┤
│ Latency │ 3 ms │ 6 ms │ 11 ms │ 13 ms │ 6.73 ms │ 2.37 ms │ 44 ms │
└─────────┴──────┴──────┴───────┴───────┴─────────┴─────────┴───────┘
┌───────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┬─────────┐
│ Stat      │ 1%      │ 2.5%    │ 50%     │ 97.5%   │ Avg     │ Stdev   │ Min     │
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Req/Sec   │ 8187    │ 8187    │ 14119   │ 14279   │ 13837.8 │ 1084.31 │ 8187    │
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Bytes/Sec │ 1.53 MB │ 1.53 MB │ 2.64 MB │ 2.67 MB │ 2.59 MB │ 203 kB  │ 1.53 MB │
└───────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┴─────────┘

Req/Bytes counts sampled once per second.

415k requests in 30.03s, 77.6 MB read