ab.exe

  • 进入cmd
ab.exe -n 10 -c 10 http://www.xxxx.com/ #一共请求10次,10个并发同时请求
ab -n 50 -c 50 -t 100 http://www.cnblogs.com/
#一共请求50次,50个并发同时请求,超时时间设为100秒, 当出现timeout时,可以设置超时时间
  • 参数说明
-n requests   #请求个数
-c concurrency #一次产生的请求个数
-t timelimit #测试所进行的最大秒数
-p postfile #POST的数据的文件
-T content-type Content-type header for POSTing #POST数据所使用的Content-type头信息
-v verbosity 设置显示信息的详细程度 - 4或更大值会显示头信息, 3或更大值可以显示响应代码(404, 200等), 2或更大值可以显示警告和其他信息。 -V 显示版本号并退出。
-w   #以HTML表的格式输出结果
-i   #执行HEAD请求,而不是GET
-C attribute    Add cookie, eg. ‘Apache=1234. (repeatable) #-C cookie-name=value 对请求附加一个Cookie:行。 其典型形式是name=value的一个参数对。此参数可以重复。

-H attribute    #Add Arbitrary header line, eg. ‘Accept-Encoding: gzip’
-A attribute    Add Basic WWW Authentication, the attributes are a colon separated username and password.