免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1764 | 回复: 0
打印 上一主题 下一主题

apache之AB压力测试 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-02-24 22:52 |只看该作者 |倒序浏览
偶尔看到这个,真是想不到,apache 本身就带有压力测试,没有测试过,有时间再试一下。

原文章在:
http://elyne.iblog.cn/index.php?op=ViewArticle&articleId=12617&blogId=1223

在unix论坛上流传过用F5把一台FreeBSD服务器刷死的帖子, 后来我也试了一下, 除了CPU占用率稍上升其它一切正常. 后来想再试一下压力测试. 搜了一下压力测试方法.原来apache已经带了一个测试工具: ab
一般把apache压力测试称为AB测试. ab工具的位置在apache2的bin目录里.ab的使用是这样的:
$ ./ab
./ab: wrong number of arguments
Usage: ./ab [options] [http://]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
    -p postfile     File containing data to POST
    -T content-type Content-type header for POSTing
    -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
    -h              Display usage information (this message)
参数很多,一般我们用 -c 和 -n 参数就可以了. 例如:
./ab -c 100 -n 10000
http://127.0.0.1/index.php
这个表示同时处理100个请求并运行10000次index.php文件.
过一阵子结果就出来了, 我的机器慢, 过了好一阵子才出来 :)
$ ./ab -c 100 -n 10000
http://127.0.0.1/index.php
This is ApacheBench, Version 2.0.41-dev  apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd,
http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation,
http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests
Server Software:        Apache/2.0.53
Server Hostname:        127.0.0.1
Server Port:            80
Document Path:          /index.php
Document Length:        17998 bytes
Concurrency Level:      100
Time taken for tests:   660.930623 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      181850000 bytes
HTML transferred:       179980000 bytes
Requests per second:    15.13 [#/sec] (mean)
Time per request:       6609.306 [ms] (mean)
Time per request:       66.093 [ms] (mean, across all concurrent requests)
Transfer rate:          268.69 [Kbytes/sec] received
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   15 117.6      0    1730
Processing:   436 6564 1142.2   6517   15395
Waiting:      340 4164 1512.2   3906   14973
Total:        436 6579 1143.4   6526   15395
Percentage of the requests served within a certain time (ms)
  50%   6526
  66%   6972
  75%   7262
  80%   7377
  90%   7755
  95%   8295
  98%   8683
  99%   9815
100%  15395 (longest request)
$



本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/12869/showart_78268.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP