apache ap 并发测试工具

可以使用 apache httpd 软件包里的 ab.exe 简单的做些网站的性能测试,

ab.exe 是一个命令工具,所以不能双击运行, 在 cmd 下运行:

ab.exe -n 1000 -c 50 http://localhost:8080/

上面 -n 是请求数, -c 是并发数

有些页面是登录后才能请求, 我们可以把 cookie 值也带过去,一种是直接设置 cookie:

ab.exe -n 1000 -c 50 -C sessionid=xxxx http://xxxx

使用大 C 来设置 cookie 值, 也可以使用设置请求头的方式来设置 cookie:

ab.exe -n 1000 -c 50 -H "Set-Cookie:xxxxxxxxx" http://xxxx

使用 -H 可以设置请求头。

ab 还可以做 post 请求, 详细参数参考

http://blog.csdn.net/kutejava/article/details/8891707

原文地址:https://www.cnblogs.com/kuku/p/8228432.html