autocannon icon indicating copy to clipboard operation
autocannon copied to clipboard

All post-run stats are zero

Open snydercoder opened this issue 4 years ago • 16 comments

What am I doing wrong with this? When I run this: autocannon -c 100 -d 20 -p 10 -l <my_url>

All the post-run stats show up like this:

┌─────────┬──────┬──────┬───────┬──────┬──────┬───────┬──────┐ │ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │ ├─────────┼──────┼──────┼───────┼──────┼──────┼───────┼──────┤ │ Latency │ 0 ms │ 0 ms │ 0 ms │ 0 ms │ 0 ms │ 0 ms │ 0 ms │ └─────────┴──────┴──────┴───────┴──────┴──────┴───────┴──────┘ ┌───────────┬─────┬──────┬─────┬───────┬─────┬───────┬─────┐ │ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │ ├───────────┼─────┼──────┼─────┼───────┼─────┼───────┼─────┤ │ Req/Sec │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ ├───────────┼─────┼──────┼─────┼───────┼─────┼───────┼─────┤ │ Bytes/Sec │ 0 B │ 0 B │ 0 B │ 0 B │ 0 B │ 0 B │ 0 B │ └───────────┴─────┴──────┴─────┴───────┴─────┴───────┴─────┘ Req/Bytes counts sampled once per second.

┌────────────┬──────────────┐ │ Percentile │ Latency (ms) │ ├────────────┼──────────────┤ │ 0.001 │ 0 │ ├────────────┼──────────────┤ │ 0.01 │ 0 │ ├────────────┼──────────────┤ │ 0.1 │ 0 │ ├────────────┼──────────────┤ │ 1 │ 0 │ ├────────────┼──────────────┤ │ 2.5 │ 0 │ ├────────────┼──────────────┤ │ 10 │ 0 │ ├────────────┼──────────────┤ │ 25 │ 0 │ ├────────────┼──────────────┤ │ 50 │ 0 │ ├────────────┼──────────────┤ │ 75 │ 0 │ ├────────────┼──────────────┤ │ 90 │ 0 │ ├────────────┼──────────────┤ │ 97.5 │ 0 │ ├────────────┼──────────────┤ │ 99 │ 0 │ ├────────────┼──────────────┤ │ 99.9 │ 0 │ ├────────────┼──────────────┤ │ 99.99 │ 0 │ ├────────────┼──────────────┤ │ 99.999 │ 0 │ └────────────┴──────────────┘

snydercoder avatar Aug 02 '20 14:08 snydercoder

likely the sever never responded.

mcollina avatar Aug 02 '20 14:08 mcollina

I'm running it against a local API built in .NET Core and it's hitting breakpoints and returning data. I tried a couple different API calls and test durations and always get zeroes.

snydercoder avatar Aug 03 '20 13:08 snydercoder

If you disable the breakpoints, does it show the data?

mcollina avatar Aug 03 '20 13:08 mcollina

If you mean does it show data in the autocannon output no, but the data is in "model" in the "return Ok(model)" of the controller action. Also, making a call to my URL in Postman does return the data fine. In addition, I did deploy it to our server to see if there was a local issue but got the same zeroes result. While running it I also monitored the server and it is definitely doing its job of providing a load. I was able to bring down my server API with it. :-)

snydercoder avatar Aug 03 '20 16:08 snydercoder

BTW, I'm running on MacOS Catalina 10.15.5.

snydercoder avatar Aug 03 '20 16:08 snydercoder

I think the problems is that not all the requests are coming back successfully. Because I'm overloading the API, some responses come back as 504 while others are successful. If I give it a lighter load that it can handle the metrics display fine. Could the intermittent 504s be messing up the metrics?

snydercoder avatar Aug 03 '20 21:08 snydercoder

Have you tried removing pipelining?

mcollina avatar Aug 04 '20 07:08 mcollina

Yes, I removed pipelining but still get zeroes if I overload the server too much with concurrent connections.

snydercoder avatar Aug 06 '20 13:08 snydercoder

I'm experiencing the same issue. For context running ab (Apache Benchmark) on same server yields expected results

oneEyedSunday avatar Mar 27 '21 23:03 oneEyedSunday

Ran into the same issue. Turned out it was because the server was not setting a Content-Length, so apparently autocannon kept waiting for the request to end. The fix was setting the Content-Length.

shalvah avatar May 19 '21 14:05 shalvah

This is a nice find. I'd take note next time I use autocannon. Should this really be an issue especially if the response isn't chunked?

On Wed, 19 May 2021, 15:38 Shalvah, @.***> wrote:

Ran into the same issue. Turned out it was because the server was not setting a Content-Length, so apparently autocannon kept waiting for the request to end. The fix was setting the Content-Length.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mcollina/autocannon/issues/273#issuecomment-844168407, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHDNOO7FRFUPSDLEOBFIJULTOPENPANCNFSM4PSSCLUA .

oneEyedSunday avatar May 19 '21 15:05 oneEyedSunday

I was surprised too. Even though the connection was being closed after sending the response. Clients like Insomnia correctly stopped, but autocannon kept waiting.

shalvah avatar May 19 '21 16:05 shalvah

I am facing the same issue. Browsers are getting response but autocannon showing zero

100 connections with 10 pipelining factor

┌─────────┬──────┬──────┬───────┬──────┬──────┬───────┬──────┐ │ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │ ├─────────┼──────┼──────┼───────┼──────┼──────┼───────┼──────┤ │ Latency │ 0 ms │ 0 ms │ 0 ms │ 0 ms │ 0 ms │ 0 ms │ 0 ms │ └─────────┴──────┴──────┴───────┴──────┴──────┴───────┴──────┘ ┌───────────┬─────┬──────┬─────┬───────┬─────┬───────┬─────┐ │ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │ ├───────────┼─────┼──────┼─────┼───────┼─────┼───────┼─────┤ │ Req/Sec │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ ├───────────┼─────┼──────┼─────┼───────┼─────┼───────┼─────┤ │ Bytes/Sec │ 0 B │ 0 B │ 0 B │ 0 B │ 0 B │ 0 B │ 0 B │ └───────────┴─────┴──────┴─────┴───────┴─────┴───────┴─────┘

Req/Bytes counts sampled once per second.

0 requests in 5.04s, 0 B read

krishnaTORQUE avatar Jun 04 '21 10:06 krishnaTORQUE

To all folks that read this: posting "me too" here will not help. Sending a PR to fix it will. Another great way is to write a server in Node.js that can be used to reliably generate this output.

mcollina avatar Jun 04 '21 13:06 mcollina

Agree. The fix should be for autocannon to count a request as ended when the connection is closed. I'll try to work on it when I have time. Autocannon's a great tool, btw.

shalvah avatar Jun 04 '21 19:06 shalvah

Thanks!

mcollina avatar Jun 04 '21 20:06 mcollina