全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 1771|回复: 9
打印 上一主题 下一主题

[疑问] 关于用AB工具测试vps的负载问题?请教大神~

[复制链接]
跳转到指定楼层
1#
发表于 2010-12-3 12:40:59 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我使用的是centos+apache+php+mysql的模式。在使用ab工具测试负载时候出现个问题。
就是使用apache中自带的测试工具ab测试网站(选了一个php的页面), -n 10 -c 1,发现失败请求数很多,请问下是什么原因呢?而且测试的数目很少,多了就不行了。
我怎么优化之?
  1. Server Software:        Apache/2.2.3
  2. Server Hostname:        www.domain.com
  3. Server Port:            80

  4. Document Path:          /
  5. Document Length:        94938 bytes

  6. Concurrency Level:      1
  7. Time taken for tests:   4.663408 seconds
  8. Complete requests:      10
  9. Failed requests:        9
  10.    (Connect: 0, Length: 9, Exceptions: 0)
  11. Write errors:           0
  12. Total transferred:      952176 bytes
  13. HTML transferred:       947366 bytes
  14. Requests per second:    2.14 [#/sec] (mean)
  15. Time per request:       466.341 [ms] (mean)
  16. Time per request:       466.341 [ms] (mean, across all concurrent requests)
  17. Transfer rate:          199.21 [Kbytes/sec] received

  18. Connection Times (ms)
  19.               min  mean[+/-sd] median   max
  20. Connect:        0    0   0.0      0       0
  21. Processing:   434  465  23.9    462     508
  22. Waiting:      433  465  23.9    462     508
  23. Total:        434  465  23.9    462     508

  24. Percentage of the requests served within a certain time (ms)
  25.   50%    462
  26.   66%    471
  27.   75%    480
  28.   80%    497
  29.   90%    508
  30.   95%    508
  31.   98%    508
  32.   99%    508
  33. 100%    508 (longest request)
复制代码
但是如果我测试的是静态页面,就没有什么问题----------这个页面时静态页面,没有任何失败请求
  1. Server Software:        Apache/2.2.3
  2. Server Hostname:        *.*.*.*
  3. Server Port:            80

  4. Document Path:          /
  5. Document Length:        1942 bytes

  6. Concurrency Level:      10
  7. Time taken for tests:   0.629372 seconds
  8. Complete requests:      1000
  9. Failed requests:        0
  10. Write errors:           0
  11. Total transferred:      2309000 bytes
  12. HTML transferred:       1942000 bytes
  13. Requests per second:    1588.89 [#/sec] (mean)
  14. Time per request:       6.294 [ms] (mean)
  15. Time per request:       0.629 [ms] (mean, across all concurrent requests)
  16. Transfer rate:          3581.35 [Kbytes/sec] received

  17. Connection Times (ms)
  18.               min  mean[+/-sd] median   max
  19. Connect:        0    0   0.4      0       5
  20. Processing:     0    5   3.6      5      41
  21. Waiting:        0    5   3.6      5      40
  22. Total:          0    5   3.7      5      41

  23. Percentage of the requests served within a certain time (ms)
  24.   50%      5
  25.   66%      6
  26.   75%      6
  27.   80%      7
  28.   90%      8
  29.   95%     10
  30.   98%     15
  31.   99%     28
  32. 100%     41 (longest request)
复制代码
大家可以看到上面第一个测试和第二个测试的差别?所以我想问下,怎么才能减少请求失败数?和优化系统?
2#
发表于 2010-12-3 12:48:19 | 只看该作者
每秒处理请求不到三个,太慢了
3#
发表于 2010-12-3 12:48:48 | 只看该作者
apache 处理不过来
4#
发表于 2010-12-3 12:49:49 | 只看该作者
纯apache是慢点,用mod_php能好些,lnamp效果就很棒了

[ 本帖最后由 yaoe 于 2010-12-3 13:01 编辑 ]
5#
 楼主| 发表于 2010-12-3 13:24:56 | 只看该作者
怎么优化?
6#
 楼主| 发表于 2010-12-3 14:30:31 | 只看该作者
。。。。。没有谁能告诉我怎么优化么?
7#
 楼主| 发表于 2010-12-3 17:18:47 | 只看该作者
但是我问了我的客户,他们说访问网站很快,并没有什么连接不上的。。。。所以我现在就很奇怪了。
ab工具测试网站动态页,性能极差。。。但是客户访问有很好。。。。不明白啊。
8#
发表于 2010-12-3 23:48:40 | 只看该作者
試試用webbench
  1. wget http://acelnmp.googlecode.com/files/webbench-1.5.tar.gz
  2. tar zxvf webbench-1.5.tar.gz
  3. cd webbench-1.5
  4. make && make install
  5. cd ..
  6. rm -rf webbench-1.5*
复制代码
使用方法

webbench -c 500 -t 30 http://www.kokgog.com/pm.php

-c表示並發數,-t表示時間(秒)
  1. webbench -c 500 -t 30 http://www.kokgog.com/pm.php
  2. Webbench - Simple Web Benchmark 1.5
  3. Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

  4. Benchmarking: GET http://www.kokgog.com/pm.php
  5. 500 clients, running 30 sec.

  6. Speed=16526 pages/min, 3028932 bytes/sec.
  7. Requests: 8263 susceed, 0 failed.
复制代码
9#
 楼主| 发表于 2010-12-4 14:18:32 | 只看该作者
我安装了,下面是测试数据
  1. webbench -c 500 -t 30 http://www.*********.com/
  2. Webbench - Simple Web Benchmark 1.5
  3. Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

  4. Benchmarking: GET http://www.************e.com/
  5. 500 clients, running 30 sec.

  6. Speed=278 pages/min, 441401 bytes/sec.
  7. Requests: 139 susceed, 0 failed.
复制代码
10#
发表于 2010-12-4 14:31:51 | 只看该作者
嗯。。就处理了139个、
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-10-7 00:31 , Processed in 0.059666 second(s), 10 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表