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

How to use aggregateResult? #506

Open
wsierakowski opened this issue Dec 19, 2023 · 1 comment
Open

How to use aggregateResult? #506

wsierakowski opened this issue Dec 19, 2023 · 1 comment

Comments

@wsierakowski
Copy link

I have the following script:

const autocannon = require('autocannon');

const test = async () => {
  const result1 = await autocannon({
    url: 'https://google.com',
    connections: 10, //default
    pipelining: 1, // default
    duration: 10, // default
    skipAggregateResult: true
  });

  const result2 = await autocannon({
    url: 'https://microsoft.com',
    connections: 10, //default
    pipelining: 1, // default
    duration: 10, // default
    skipAggregateResult: true
  });

  autocannon.aggregateResult([result1, result2]);
};

test();

This returns:

node_modules/autocannon/lib/validate.js:88
    return new Error('url or socketPath option required')
@xt-riot
Copy link

xt-riot commented Jan 14, 2025

Hello @wsierakowski,

This tool is intended for load-testing your own servers. Firing requests over to someone else's server might seem like a DDoS attempt which may result in severe consequences.

That being said, the aggregateResult function gets two parameters: one array with your autocannon instances' results(with skipAggregateResult set to true, as you have done) and an opts object with a required url field. You are missing the second param.

autocannon.aggregateResult([result1, result2], { url: 'http://some-url' });

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

No branches or pull requests

2 participants