question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`--amount` is not precise with high concurrency

See original GitHub issue

Example server (modified from restify/benchmarks):

// bare.js
'use strict'

let i = 0
const server = require('http').createServer(function (req, res) {
  i++
  res.setHeader('content-type', 'application/json; charset=utf-8')
  res.end(JSON.stringify({ hello: 'world' }))
})
process.on('SIGINT', () => {process._rawDebug(`Reqs' ${i}`); process.exit(0)})

server.listen(3000)

Running npx against the server above with -a 1000000 and with the same parameters used on restify/benchmarks:

$ node benchmarks/bare.js &
[1] 14966

$ npx autocannon --debug -c 100 -p 10 -a 1000000 localhost:3000
Running 1000000 requests test @ http://localhost:3000
100 connections with 10 pipelining factor

running [====================] 99%β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Stat    β”‚ 2.5% β”‚ 50%  β”‚ 97.5% β”‚ 99%   β”‚ Avg     β”‚ Stdev   β”‚ Max      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Latency β”‚ 0 ms β”‚ 0 ms β”‚ 11 ms β”‚ 13 ms β”‚ 1.42 ms β”‚ 3.75 ms β”‚ 130.8 ms β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Stat      β”‚ 1%     β”‚ 2.5%   β”‚ 50%     β”‚ 97.5%   β”‚ Avg      β”‚ Stdev    β”‚ Min    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Req/Sec   β”‚ 5211   β”‚ 5211   β”‚ 68927   β”‚ 75967   β”‚ 62447.63 β”‚ 17040.52 β”‚ 5208   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Bytes/Sec β”‚ 855 kB β”‚ 855 kB β”‚ 11.3 MB β”‚ 12.5 MB β”‚ 10.2 MB  β”‚ 2.8 MB   β”‚ 854 kB β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Req/Bytes counts sampled once per second.

999k requests in 16.08s, 164 MB read

$ kill -INT 14966
Reqs' 999969                                                                                                                                                                                                                                                                                                                                                                                                                                 
[1]  + 14966 done       node benchmarks/bare.js

autocannon reports 999k requests (instead of 1000k), and when we stop the server it reports 999969 requests (instead of 1000000). With -c 1 and -p 1 the server will reply to 1000000 requests correctly.

This might be the server unable to handle that many concurrent requests, but autocannon doesn’t report any errors (not even with --debug), so it might be a bug on autocannon as well.

I saw this issue on both Node.js v10 and v12, and on autocannon 3.2.2 as well as 4.4.0.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
elirandavcommented, Jul 6, 2021

sure. I created a pull request @mcollina

0reactions
mcollinacommented, Jul 4, 2021

@elirandav Would you like to send a Pull Request to address this issue? Remember to add unit tests.

Read more comments on GitHub >

github_iconTop Results From Across the Web

High-concurrency counters without sharding - Stack Overflow
Here are the tradeoffs I see: 2 does not require datastore transactions. To get the counter's value, #2 requires a datastore fetch while...
Read more >
A Concurrency Cost Hierarchy - Performance Matters
Concurrent operations can be grouped relatively neatly into categories based on their cost.
Read more >
Working with concurrency scaling - Amazon Redshift
With the Concurrency Scaling feature, you can support virtually unlimited concurrent users and concurrent queries, with consistently fast query performance.
Read more >
Concurrency problems - theory and experimentation in SQL ...
Both transactions do not update this record to the same value. ... If no precision is made about a transaction isolation level in...
Read more >
Warehouse Considerations - Snowflake Documentation
It does not provide specific or absolute numbers, values, ... including number of concurrent users/queries, number of tables being queried, and data size...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found