【即将关站通知●已关闭注册功能】,倒计时剩余:计算中...

apache环境中ab命令参数详细简介及结果分析


ab(apache bench)是apache下的一个工具,主要用于对web站点做压力测试,

基础用法:
-c选项为一次发送的请求数量,及并发量。
-n选项为请求次数。
实际测试效果:

  1. [dev@web ~]$ ab -c 20 -n 50000 http://192.168.1.210/
  2. This is ApacheBench, Version 2.3 <$Revision: 655654 $>
  3. Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
  4. Licensed to The Apache Software Foundation, http://www.apache.org/
  5. Benchmarking 192.168.1.210 (be patient)
  6. Completed 5000 requests
  7. Completed 10000 requests
  8. Completed 15000 requests
  9. Completed 20000 requests
  10. Completed 25000 requests
  11. Completed 30000 requests
  12. Completed 35000 requests
  13. Completed 40000 requests
  14. Completed 45000 requests
  15. Completed 50000 requests
  16. Finished 50000 requests
  17. Server Software: nginx/1.6.2
  18. Server Hostname: 192.168.1.210
  19. Server Port: 80
  20. Document Path: /
  21. Document Length: 41005 bytes # 请求的页面大小
  22. Concurrency Level: 20 # 并发量
  23. Time taken for tests: 1180.733 seconds # 测试总共耗时
  24. Complete requests: 50000 # 完成的请求
  25. Failed requests: 0 # 失败的请求
  26. Write errors: 0 # 错误
  27. Total transferred: 2067550000 bytes # 总共传输数据量
  28. HTML transferred: 2050250000 bytes
  29. Requests per second: 42.35 [#/sec] (mean) # 每秒钟的请求量。(仅仅是测试页面的响应速度)
  30. Time per request: 472.293 [ms] (mean) # 等于 Time taken for tests/(complete requests/concurrency level) 即平均请求等待时间(用户等待的时间)
  31. Time per request: 23.615 [ms] (mean, across all concurrent requests) # 等于 Time taken for tests/Complete requests 即服务器平均请求响应时间 在并发量为1时 用户等待时间相同
  32. Transfer rate: 1710.03 [Kbytes/sec] received # 平均每秒多少K,即带宽速率
  33. Connection Times (ms)
  34. min mean[+/-sd] median max
  35. Connect: 0 1 18.5 0 1001
  36. Processing: 38 471 534.1 155 9269
  37. Waiting: 37 456 524.6 147 9259
  38. Total: 40 472 534.5 155 9269
  39. Percentage of the requests served within a certain time (ms)
  40. 50% 155
  41. 66% 571
  42. 75% 783
  43. 80% 871
  44. 90% 1211
  45. 95% 1603
  46. 98% 1839
  47. 99% 2003
  48. 100% 9269 (longest request)

上边只记录了一些常用参数,其他参数介绍这里也贴一下:
Usage: ab [options] [http[s]://]hostname[:port]/path
Options are:
-n requests Number of requests to perform
-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 #
-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’
-v verbosity How much troubleshooting info to print
-w Print out results in HTML tables
-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 attributes
are a colon separated username and password.
-P attribute Add Basic Proxy Authentication, the attributes
are a colon separated username and password.
-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)
-Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers)
-f protocol Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL)

站到前辈的肩膀人上,才能站的更高,看的更远。

收藏 邀请

路过

雷人

握手

鲜花

鸡蛋


最新评论

在线支持
关闭
欢迎来到魔趣吧
如果你有建站技术问题、仿站需求、模板插件修改需求,请联系我们的技术支持!高效率,低价格的帮你搞定!
请认准魔趣吧唯一官网:www.moqu8.com,谨防假冒网站!

一般问题请到【求助区】发帖咨询(免费)!

邮箱咨询:
winkill2012@qq.com

邮箱咨询需注明:资源地址+本站用户名+具体问题,三者缺一不做处理。非本站资源不处理!
在线支持

关于魔趣吧|魔趣建站

魔趣吧,志在打造全国最大的建站资源共享平台。 本站提供海量免费的建站资源,包括WordPress模板、Discuz精仿模板、PHPWind模板、phpcms模板、Discuz精仿插件、帝国cms模板、织梦模板等上万精品模板!同时,提供各种建站素材、JS特效、整站程序源码!
服务中文站长,传播分享精神!建站,就来魔趣吧!!
2015-2024 魔趣吧 ( 豫ICP备2021024354号 )   豫公网安备41030402000182号 百度统计
HTTPS安全认证
|网站地图 | 已运行:天 
温馨提示:本站所有资源、教程、源码,不得用于非法站点及用途,否则,本站将终止提供任何服务! Powered by Discuz! Licensed