{"id":18139,"library":"autocannon","title":"autocannon","description":"An HTTP/1.1 benchmarking tool for Node.js, designed to be fast and easy to use. Current stable version is 8.0.0, released in late 2021. It supports HTTP pipelining, HTTPS, and can produce more load than wrk or wrk2. It offers both a command-line interface and a programmatic API, with features like warm-up, worker threads, HAR file replay, and custom request bodies. The project is actively maintained by the Node.js community.","status":"active","version":"8.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/mcollina/autocannon","tags":["javascript","http","soak","load","fast","wrk","ab","test"],"install":[{"cmd":"npm install autocannon","lang":"bash","label":"npm"},{"cmd":"yarn add autocannon","lang":"bash","label":"yarn"},{"cmd":"pnpm add autocannon","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for building native addons (ReusePort).","package":"node-gyp-build","optional":true}],"imports":[{"note":"ESM-only since v8; CJS deprecation warning since v7.","wrong":"const autocannon = require('autocannon')","symbol":"default","correct":"import autocannon from 'autocannon'"},{"note":"track is a static method on the default export, not a named export.","wrong":"import { track } from 'autocannon'; track(instance)","symbol":"autocannon.track","correct":"import autocannon from 'autocannon'; autocannon.track(instance)"},{"note":"Result is exported as a type via the default export's namespace, not a named export.","wrong":"import { Result } from 'autocannon'","symbol":"Result type","correct":"import autocannon from 'autocannon'; const result: autocannon.Result = ..."}],"quickstart":{"code":"import autocannon from 'autocannon';\n\nconst instance = autocannon({\n  url: 'http://localhost:3000',\n  connections: 10,\n  duration: 10,\n}, (err, result) => {\n  if (err) {\n    console.error(err);\n    return;\n  }\n  console.log(result);\n});\n\nautocannon.track(instance);","lang":"typescript","description":"Runs a 10-second benchmark with 10 concurrent connections against a local server and prints progress to console."},"warnings":[{"fix":"Update imports to use ESM syntax; do not use require().","message":"autocannon v8 dropped CommonJS support; requires ESM imports.","severity":"breaking","affected_versions":">=8.0.0"},{"fix":"Replace autocannon.printResult(output, result) with autocannon.print(output, result).","message":"The 'printResult' function is deprecated in favor of 'autocannon.print'. In v8, 'printResult' may be removed.","severity":"deprecated","affected_versions":">=7.0.0"},{"fix":"Use autocannon.track() or listen for 'done' event on the instance.","message":"When using '--workers', the callback in the programmatic API is not called; results are only available via track or event listeners.","severity":"gotcha","affected_versions":"*"},{"fix":"Use only one of 'amount' or 'duration' at a time.","message":"Setting both 'amount' and 'duration' will cause 'duration' to be ignored.","severity":"gotcha","affected_versions":"*"},{"fix":"Ensure the 'requests' array contains objects with 'method', 'path', 'headers', 'body' as needed.","message":"When using a custom 'requestIterator', the 'requests' option inside the iterator must be an array of objects with 'method', 'path', etc., not just strings.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Replace require('autocannon') with import autocannon from 'autocannon' or use dynamic import().","cause":"Using require() to import autocannon v8 which is ESM-only.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/autocannon/index.js from /path/to/your.js not supported."},{"fix":"Use import autocannon from 'autocannon' (default import).","cause":"Importing autocannon incorrectly; e.g., importing named export instead of default.","error":"autocannon is not a function"},{"fix":"Ensure the server is running on the specified port; check URL and port.","cause":"Target server is not running or port is wrong.","error":"connect ECONNREFUSED 127.0.0.1:3000"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}