Skip to content

Instantly share code, notes, and snippets.

@jamal-abbasi
Created July 31, 2022 08:36
Show Gist options
  • Save jamal-abbasi/16925763e93b3e4a8f28970c403125ec to your computer and use it in GitHub Desktop.
Save jamal-abbasi/16925763e93b3e4a8f28970c403125ec to your computer and use it in GitHub Desktop.
Autocannon script used to stress tests the api's with clinicjs to see the quality issues in code
'use strict'
const autocannon = require('autocannon')
function startBench() {
const url = 'http://localhost:10105';
autocannon({
url,
connections: 10, //default
pipelining: 1, // default
duration: 10, // default
headers: {
"Content-Type": 'application/json',
"authorization": ''
},
requests : [
{
method: 'GET',
path: '/',//api url
}
]
}, finishedBench);
}
function finishedBench(err, res) {
console.log('finished bench', err, res);
};
startBench();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment