Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avg latency is wrong when using pipelining #315

Closed
simoneb opened this issue Dec 14, 2020 · 1 comment · Fixed by #317
Closed

Avg latency is wrong when using pipelining #315

simoneb opened this issue Dec 14, 2020 · 1 comment · Fixed by #317

Comments

@simoneb
Copy link
Contributor

simoneb commented Dec 14, 2020

This was apparently addressed in a very old issue #15 but I am still seeing something wrong with latency when pipelining is used, especially in AVG. This is unless I'm interpreting the number wrong. I assume latency is the time a request takes to complete, as described in the docs.

Here's my web app:

const http = require("http");

http
  .createServer(function (req, res) {
    setTimeout(function () {
      res.end("hello world");
    }, 500);
  })
  .listen(3000);

And here's autocannon's output without and then with pipelining:

# without pipelining

autocannon http://localhost:3000
Running 10s test @ http://localhost:3000
10 connections

┌─────────┬────────┬────────┬────────┬────────┬───────────┬─────────┬────────┐
│ Stat    │ 2.5%   │ 50%    │ 97.5%  │ 99%    │ Avg       │ Stdev   │ Max    │
├─────────┼────────┼────────┼────────┼────────┼───────────┼─────────┼────────┤
│ Latency │ 499 ms │ 513 ms │ 522 ms │ 523 ms │ 510.27 ms │ 6.47 ms │ 523 ms │
└─────────┴────────┴────────┴────────┴────────┴───────────┴─────────┴────────┘
# with pipelining

autocannon http://localhost:3000 -p 2
Running 10s test @ http://localhost:3000
10 connections with 2 pipelining factor

┌─────────┬──────┬──────┬────────┬────────┬───────────┬───────────┬────────┐
│ Stat    │ 2.5% │ 50%  │ 97.5%  │ 99%    │ Avg       │ Stdev     │ Max    │
├─────────┼──────┼──────┼────────┼────────┼───────────┼───────────┼────────┤
│ Latency │ 0 ms │ 0 ms │ 527 ms │ 528 ms │ 256.62 ms │ 256.65 ms │ 530 ms │
└─────────┴──────┴──────┴────────┴────────┴───────────┴───────────┴────────┘

As you can see, the AVG latency when using pipelining seems to be divided by the pipelining factor, which doesn't sound right to me, in the sense that the server is still responding in ~500ms, so the average latency should always be around that value. Possibly as a consequence of that, Stdev also becomes wrong.

@mcollina
Copy link
Owner

Good spot, PR? I never look at the avg latency, just at 99% percentile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants