热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Apacheab压力测试笔记

ab.exe目录apache\binab相关指令:Optionsare:-nrequestsNumberofrequeststoperform(请

ab.exe目录

apache\bin

ab相关指令:

Options are:-n requests Number of requests to perform(请求的总数,默认是1次。)-c concurrency Number of multiple requests to make(并发数,同一时间请求数。)-t timelimit Seconds to max. wait for responses-b windowsize Size of TCP send/receive buffer, in bytes-B address Address to bind to when making outgoing connections-p postfile File containing data to POST. Remember also to set -T-u putfile File containing data to PUT. Remember also to set -T-T content-type Content-type header for POSTing, eg.'application/x-www-form-urlencoded'Default is 'text/plain' (设置请求头中的Content-type(针对POST/PUT),比如:application/x-www-form-urlencoded。默认是text/plain。)-v verbosity How much troubleshooting info to print-w Print out results in HTML tables (将测试结果打印到HTML表格中。)-i Use HEAD instead of GET-x attributes String to insert as table attributes-y attributes String to insert as tr attributes-z attributes String to insert as td or th attributes-C attribute Add COOKIE, eg. 'Apache=1234'. (repeatable)-H attribute Add Arbitrary header line, eg. 'Accept-Encoding: gzip'Inserted after all normal header lines. (repeatable)-A attribute Add Basic WWW Authentication, the attributesare a colon separated username and password.-P attribute Add Basic Proxy Authentication, the attributesare a colon separated username and password.( 如果后面接的是文件,表示POST请求,文件中包含请求数据,根据数据格式,设置-T参数。)-X proxy:port Proxyserver and port number to use-V Print version number and exit-k Use HTTP KeepAlive feature-d Do not show percentiles served table.-S Do not show confidence estimators and warnings.-g filename Output collected data to gnuplot format file.-e filename Output CSV file with percentages served-r Don't exit on socket receive errors.-h Display usage information (this message)

实例:

ab -c 300 -n 300 "http://www.abc.com:80/test/aaaa?a=1&b=2&c=3"

测试结果样例:

Concurrency Level    并发数多少,等于-c后面的数值
Time taken for tests    测试总耗时
Complete requests    成功收到返回的数目
Failed requests    请求失败数目,可能因为网络连接,异常,请求数据长度等等
Non-2xx responses    表示返回的HTTP status code不是2xx的数目(比如404,401,500...),如果都是2xx,这个指标不显示在结果里面
Requests per second    每秒请求数,等于总请求数/测试总耗时
Time per request    每一个请求平均花费时间。第一个Time per request等于concurrency * timetaken * 1000 / done,第二个Time per request(mean, across all concurrency requests)等于timetaken * 1000 / done,第一个可以理解为用户平均请求等待时间,第二可以理解为服务器平均请求等待时间

 


推荐阅读
author-avatar
手机用户2502927277
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有