日期:2014-05-16  浏览次数:20865 次

apache 压力测试工具ab(apache benchmark)

ab的全称是ApacheBench Apache 附带的一个小工具专门用于 HTTP Server benchmark testing可以同时模拟多个并发请求。

?

/*在这个例子的一开始,我执行了这样一个命令 ab -n 10 -c 10 http://www.google.com/这个命令的意思是启动 ab ,向 www.google.com 发送10个请求(-n 10)?,并每次发送10个请求(-c 10)——也就是说一次都发过去了。跟着下面的是 ab 输出的测试报告,红色部分是我添加的注释。*/

C:\Program Files\Apache Software Foundation\Apache2.2\bin>ab -n 10 -c 10 http ://www.google.com/index.html

This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/

?

Benchmarking www.google.com (be patient).....done

?

Server Software:??????? GWS/2.1? /*被测试的web服务器名称,它来自HTTP响应数据的头信息*/

Server Hostname:??????? www.google.com? /*请求URL 中主机部分名称,它来自HTTP请求数据的头信息*/

Server Port:??????????? 80?? /*被测试web服务器的监听端口*/

?

Document Path:????????? /index.html?? /*表示请求URL中的根绝对路径,它来自HTTP请求数据的头信息*/

Document Length:??????? 230 bytes /* 表示HTTP响应数据的正文长度*/