Chinaunix首页 | 论坛 | 博客
  • 博客访问: 501835
  • 博文数量: 99
  • 博客积分: 2030
  • 博客等级: 大尉
  • 技术积分: 783
  • 用 户 组: 普通用户
  • 注册时间: 2006-08-12 09:11
文章分类

全部博文(99)

文章存档

2023年(2)

2022年(1)

2020年(1)

2019年(1)

2018年(4)

2017年(16)

2016年(60)

2015年(1)

2013年(3)

2006年(10)

我的朋友

分类: Java

2016-11-22 12:30:40

第一步:安装
    
apt-get install apache2-utils
 如果系统没有更新请先更新系统资源
apt-get update
 安装完成后输入以下命令,查看版本
~# ab -V
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://
Licensed to The Apache Software Foundation, http:
第二步:测试
   
  1.  ab -c 10 -n 100
 -c 10 并发用户数
-n 100 总请求数

  1. This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
  2. Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
  3. Licensed to The Apache Software Foundation, http://www.apache.org/

  4. Benchmarking localhost (be patient).....done


  5. Server Software: Apache-Coyote/1.1
  6. Server Hostname: localhost
  7. Server Port: 80

  8. Document Path: /index.jsp
  9. Document Length: 203 bytes //响应数据的长度

  10. Concurrency Level: 10 // 并发用户数,参数
  11. Time taken for tests: 0.145 seconds   // 所有请求被处理完成所花费的总时间
  12. Complete requests: 100   // 请求数
  13. Failed requests: 77     // 失败的请求数
  14.    (Connect: 0, Receive: 0, Length: 77, Exceptions: 0)
  15. Total transferred: 93875 bytes
  16. HTML transferred: 77823 bytes
  17. Requests per second: 688.21 [#/sec] (mean)     //吞吐率
  18. Time per request: 14.530 [ms] (mean)    // 用户平均请求等待时间
  19. Time per request: 1.453 [ms] (mean, across all concurrent requests)   // 服务器平均请求处理时间
  20. Transfer rate: 630.92 [Kbytes/sec] received  

  21. Connection Times (ms)
  22.               min mean[+/-sd] median max
  23. Connect: 0 0 0.6 0 3
  24. Processing: 0 9 21.8 2 138
  25. Waiting: 0 8 21.6 1 138
  26. Total: 1 9 21.8 2 139

  27. Percentage of the requests served within a certain time (ms)
  28.   50% 2
  29.   66% 3
  30.   75% 3
  31.   80% 3
  32.   90% 55
  33.   95% 57
  34.   98% 99
  35.   99% 139
  36.  100% 139 (longest request)
第三步:数据统计查找最优
  
并发用户数 请求等待时间(ms) 请求处理时间(ms) 吞吐率(reqs/s)
1 0.316 0.316 3164.12
5 1.267 0.253 3946.41
10 2.693 0.269 3713.81
20 6.365 0.318 3142.07
50 13.876 0.278 3603.32
100 26.831 0.268 3727.02
200 52.462 0.262 3812.27
400 114.739 0.287 3486.17
600 182.193 0.304 3293.21
800 227.7 0.285 3513.39


阅读(863) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~