Skip to content

Instantly share code, notes, and snippets.

@ShivamJoker
Created December 5, 2021 11:11
Show Gist options
  • Save ShivamJoker/898eedd02c619f8a348c43674765d509 to your computer and use it in GitHub Desktop.
Save ShivamJoker/898eedd02c619f8a348c43674765d509 to your computer and use it in GitHub Desktop.
nodejs stream benchmarks
❯ autocannon -c 5 -a 5 --timeout 1000000 'http://143.110.241.172/stream?limit=100000'
Running 5 requests test @ http://143.110.241.172/stream?limit=100000
5 connections
┌─────────┬──────────┬──────────┬──────────┬──────────┬────────────┬──────────┬──────────┐
│ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │
├─────────┼──────────┼──────────┼──────────┼──────────┼────────────┼──────────┼──────────┤
│ Latency │ 14475 ms │ 14588 ms │ 15197 ms │ 15197 ms │ 14666.8 ms │ 270.1 ms │ 15197 ms │
└─────────┴──────────┴──────────┴──────────┴──────────┴────────────┴──────────┴──────────┘
┌───────────┬─────┬──────┬─────┬─────────┬─────────┬─────────┬─────────┐
│ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │
├───────────┼─────┼──────┼─────┼─────────┼─────────┼─────────┼─────────┤
│ Req/Sec │ 0 │ 0 │ 0 │ 4 │ 0.32 │ 0.99 │ 1 │
├───────────┼─────┼──────┼─────┼─────────┼─────────┼─────────┼─────────┤
│ Bytes/Sec │ 0 B │ 0 B │ 0 B │ 83.4 MB │ 6.51 MB │ 20.5 MB │ 20.8 MB │
└───────────┴─────┴──────┴─────┴─────────┴─────────┴─────────┴─────────┘
Req/Bytes counts sampled once per second.
5 requests in 16.01s, 104 MB read
❯ autocannon -c 5 -a 5 --timeout 1000000 'http://143.110.241.172/?limit=100000'
Running 5 requests test @ http://143.110.241.172/?limit=100000
5 connections
┌─────────┬──────────┬──────────┬──────────┬──────────┬────────────┬───────────┬──────────┐
│ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │
├─────────┼──────────┼──────────┼──────────┼──────────┼────────────┼───────────┼──────────┤
│ Latency │ 19684 ms │ 21981 ms │ 26093 ms │ 26093 ms │ 22573.4 ms │ 2419.8 ms │ 26093 ms │
└─────────┴──────────┴──────────┴──────────┴──────────┴────────────┴───────────┴──────────┘
┌───────────┬─────┬──────┬─────┬─────────┬─────────┬─────────┬─────────┐
│ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │
├───────────┼─────┼──────┼─────┼─────────┼─────────┼─────────┼─────────┤
│ Req/Sec │ 0 │ 0 │ 0 │ 1 │ 0.19 │ 0.39 │ 1 │
├───────────┼─────┼──────┼─────┼─────────┼─────────┼─────────┼─────────┤
│ Bytes/Sec │ 0 B │ 0 B │ 0 B │ 20.8 MB │ 3.86 MB │ 8.09 MB │ 20.8 MB │
└───────────┴─────┴──────┴─────┴─────────┴─────────┴─────────┴─────────┘
Req/Bytes counts sampled once per second.
5 requests in 27.02s, 104 MB read
❯ autocannon -c 5 -a 5 --timeout 1000000 'http://143.110.241.172/stream?limit=500000'
Running 5 requests test @ http://143.110.241.172/stream?limit=500000
5 connections
┌─────────┬──────────┬──────────┬──────────┬──────────┬─────────────┬────────────┬──────────┐
│ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │
├─────────┼──────────┼──────────┼──────────┼──────────┼─────────────┼────────────┼──────────┤
│ Latency │ 69390 ms │ 69470 ms │ 73435 ms │ 73435 ms │ 70357.61 ms │ 1559.65 ms │ 73435 ms │
└─────────┴──────────┴──────────┴──────────┴──────────┴─────────────┴────────────┴──────────┘
┌───────────┬─────┬──────┬─────┬────────┬─────────┬─────────┬────────┐
│ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │
├───────────┼─────┼──────┼─────┼────────┼─────────┼─────────┼────────┤
│ Req/Sec │ 0 │ 0 │ 0 │ 1 │ 0.07 │ 0.38 │ 1 │
├───────────┼─────┼──────┼─────┼────────┼─────────┼─────────┼────────┤
│ Bytes/Sec │ 0 B │ 0 B │ 0 B │ 104 MB │ 7.06 MB │ 39.7 MB │ 104 MB │
└───────────┴─────┴──────┴─────┴────────┴─────────┴─────────┴────────┘
Req/Bytes counts sampled once per second.
5 requests in 74.02s, 522 MB read
❯ autocannon -c 5 -a 5 --timeout 1000000 'http://143.110.241.172/?limit=500000'
Running 5 requests test @ http://143.110.241.172/?limit=500000
5 connections
┌─────────┬──────────┬──────────┬──────────┬──────────┬────────────┬────────┬──────────┐
│ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │
├─────────┼──────────┼──────────┼──────────┼──────────┼────────────┼────────┼──────────┤
│ Latency │ 29753 ms │ 29756 ms │ 29757 ms │ 29757 ms │ 29755.6 ms │ 1.5 ms │ 29757 ms │
└─────────┴──────────┴──────────┴──────────┴──────────┴────────────┴────────┴──────────┘
┌───────────┬─────┬──────┬─────┬─────────┬────────┬───────┬─────────┐
│ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │
├───────────┼─────┼──────┼─────┼─────────┼────────┼───────┼─────────┤
│ Req/Sec │ 0 │ 0 │ 0 │ 5 │ 0.17 │ 0.9 │ 5 │
├───────────┼─────┼──────┼─────┼─────────┼────────┼───────┼─────────┤
│ Bytes/Sec │ 0 B │ 0 B │ 0 B │ 1.66 kB │ 55.3 B │ 298 B │ 1.66 kB │
└───────────┴─────┴──────┴─────┴─────────┴────────┴───────┴─────────┘
Req/Bytes counts sampled once per second.
0 2xx responses, 5 non 2xx responses
5 requests in 30.03s, 1.66 kB read
❯ autocannon -c 5 -a 5 --timeout 1000000 'http://143.110.241.172/stream?limit=1000000'
Running 5 requests test @ http://143.110.241.172/stream?limit=1000000
5 connections
┌─────────┬───────────┬───────────┬───────────┬───────────┬─────────────┬─────────┬───────────┐
│ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │
├─────────┼───────────┼───────────┼───────────┼───────────┼─────────────┼─────────┼───────────┤
│ Latency │ 159540 ms │ 159544 ms │ 159546 ms │ 159546 ms │ 159543.8 ms │ 2.04 ms │ 159546 ms │
└─────────┴───────────┴───────────┴───────────┴───────────┴─────────────┴─────────┴───────────┘
┌───────────┬─────┬──────┬─────┬───────┬─────────┬─────────┬─────────┐
│ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │
├───────────┼─────┼──────┼─────┼───────┼─────────┼─────────┼─────────┤
│ Req/Sec │ 0 │ 0 │ 0 │ 0 │ 0.04 │ 0.4 │ 5 │
├───────────┼─────┼──────┼─────┼───────┼─────────┼─────────┼─────────┤
│ Bytes/Sec │ 0 B │ 0 B │ 0 B │ 0 B │ 6.55 MB │ 82.5 MB │ 1.05 GB │
└───────────┴─────┴──────┴─────┴───────┴─────────┴─────────┴─────────┘
Req/Bytes counts sampled once per second.
5 requests in 160.04s, 1.05 GB read
❯ autocannon -c 5 -a 5 --timeout 1000000 'http://143.110.241.172/stream?limit=5000000'
Running 5 requests test @ http://143.110.241.172/stream?limit=5000000
5 connections
running [ ] 0%/Users/shivam/.config/yarn/global/node_modules/autocannon/node_modules/http-parser-js/http-parser.js:129
throw err;
^
RangeError: Invalid string length
at PipelinedRequestsQueue.addBody (/Users/shivam/.config/yarn/global/node_modules/autocannon/lib/pipelinedRequestsQueue.js:44:19)
at HTTPParser.Client.parser.<computed> (/Users/shivam/.config/yarn/global/node_modules/autocannon/lib/httpClient.js:83:28)
at HTTPParser.BODY_CHUNK (/Users/shivam/.config/yarn/global/node_modules/autocannon/node_modules/http-parser-js/http-parser.js:393:32)
at HTTPParser.execute (/Users/shivam/.config/yarn/global/node_modules/autocannon/node_modules/http-parser-js/http-parser.js:123:27)
at Socket.<anonymous> (/Users/shivam/.config/yarn/global/node_modules/autocannon/lib/httpClient.js:140:17)
at Socket.emit (node:events:390:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at TCP.onStreamRead (node:internal/stream_base_commons:199:23)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment