node.js 快速 HTTP/1.1 基准测试工具

・4 分钟阅读

  • 源代码名称: autocannon
  • 源代码网址:
  • autocannon的文档
  • autocannon的源代码下载
  • Git URL:
  • Git Clone代码到本地:
    git clone
  • Subversion代码到本地:
    $ svn co --depth empty
                              Checked out revision 1.
                              $ cd repo
                              $ svn up trunk
  • banner


    Join the chat at Build StatusAppveyor Build Status



    npm i autocannon -g


    npm i autocannon --save



    Usage: autocannon [opts] URL
    URL is any valid http or https url.
    Available options:
     -c/--connections NUM
     The number of concurrent connections to use. default: 10.
     -p/--pipelining NUM
     The number of pipelined requests to use. default: 1.
     -d/--duration SEC
     The number of seconds to run the autocannnon. default: 10.
     -a/--amount NUM
     The amount of requests to make before exiting the benchmark. If set, duration is ignored.
     A path to a Unix Domain Socket or a Windows Named Pipe. A URL is still required in order to send the correct Host header and path.
     -m/--method METHOD
     The http method to use. default: 'GET'.
     -t/--timeout NUM
     The number of seconds before timing out and resetting a connection. default: 10
     -T/--title TITLE
     The title to place in the results for identification.
     -b/--body BODY
     The body of the request.
     -i/--input FILE
     The body of the request.
     -H/--headers K=V
     The request headers.
     -B/--bailout NUM
     The number of failures before initiating a bailout.
     -M/--maxConnectionRequests NUM
     The max number of requests to make per connection to the server.
     -O/--maxOverallRequests NUM
     The max number of requests to make overall to the server.
     -r/--connectionRate NUM
     The max number of requests to make per second from an individual connection.
     -R/--overallRate NUM
     The max number of requests to make per second from an all connections.
     connection rate will take precedence if both are set.
     NOTE: if using rate limiting and a very large rate is entered which cannot be met,
     Autocannon will do as many requests as possible per second.
     -D/--reconnectRate NUM
     Some number of requests to make before resetting a connections connection to the
     Don't render the progress bar. default: false.
     Print all the latency data. default: false.
     Enable replacement of [<id>] with a randomly generated ID within the request body. default: false.
     Print the output as newline delimited json. This will cause the progress bar and results not to be rendered. default: false.
     Run the benchmark forever. Efficiently restarts the benchmark on completion. default: false.
     Server name for the SNI (Server Name Indication) TLS extension.
     Exclude error statistics (non 2xx http responses) from the final latency and bytes per second averages. default: false.
     Print the version number.
     Print this menu.


    'use strict'constautocannon=require('autocannon')autocannon({
     connections:10, //default pipelining:1, // default duration:10// default}, console.log)
    Fansisi profile image