mcollina / autocannon

fast HTTP/1.1 benchmarking tool written in Node.js
MIT License
7.83k stars 325 forks source link

Max throughput is reported as negative #87

Closed mcollina closed 8 years ago

mcollina commented 8 years ago

This is the server:

const http = require('http');
var len = 1024 * 1024 * 1024;
var chunk = Buffer.alloc(len, 'x');

var server = http.createServer(function(req, res) {
  res.write(chunk);
  res.end()
});

server.listen(1234, function() {
});

And I am using this line: ./autocannon.js -d 10 -j localhost:1234

Running 10s test @ http://localhost:1234
10 connections

Stat         Avg    Stdev   Max
Latency (ms) 7344   1129.22 9497
Req/Sec      1      1.85    6
Bytes/Sec    1.1 GB 2.02 GB -1.88 GB

10 requests in 10s, 10.74 GB read

I think the problem lies in the int32 conversion:

https://github.com/mcollina/native-hdr-histogram/blob/master/hdr_histogram_wrap.cc#L91-L107

Damn, I remember thinking I will never hit that bug when I wrote those lines.....

mcollina commented 8 years ago

cc @bzoz

bzoz commented 8 years ago

Cast to int32_t done here in native-hdr-histogram is to blame. Just found it too.

Edit: ah, I see you know the reason