apachebench对网站进行并发测试

1,安装apache
2,打开cmd进入apache安装目录的bin目录(有ab.exe)
3,执行ab命令
格式:ab -n 10000 -c 2000 http://localhost:80/test/test.php
说明:表示这个脚本运行10000次,2000并发(模拟2000个用户同时访问)

ab常用参数介绍:

    -n requests :Number of requests to perform(总共的请求执行数,缺省是1);

  -c concurrency : Number of multiple requests to make(并发数,缺省是1);

  -t timelimit :Seconds to max. wait for responses(测试所进行的总时间,秒为单位,缺省50000s);

  -p postfile : File containing data to POST. Remember also to set -T(POST时的数据文件)

    -u putfile File containing data to PUT. Remember also to set -T(GET时的数据文件)

  -w : Print out results in HTML tables(以HTML表的格式输出结果)
原文地址:https://www.cnblogs.com/boluoboluo/p/6428019.html