CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
IBM Rational 系统开发最佳实践工具包 WebSphere MQ 最佳实践 TOP 15
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Web 开发 >  Apache

用apache作压力测试怎么做?

楼主lib001()2006-03-10 14:55:09 在 Web 开发 / Apache 提问

 
         
  我听朋友说,用apache可以作网站的压力测试,挺好的,      
  怎么做呀?      
  问题点数:100、回复次数:3Top

1 楼ice_berg16(寻梦的稻草人)回复于 2006-03-10 15:26:25 得分 20

apache有一个自带工具apache   bench(简称ab)  
   
  ab   -c   20   -n   1000   CGI/脚本URL  
  此命令表示使用   20   个并发连接,进行   1000   次请求。  
  Top

2 楼Fufay(☆梅笑寒☆ MSN: fufay@126.com)回复于 2006-03-12 14:19:06 得分 20

"用apache可以作网站的压力测试",这句话另我很费解;  
  apache是web服务器软件,不可以做压力测试。  
  楼上说了,apache自带一个ab软件。  
  如果你是WIN平台,ab在   apache安装目录下   \bin   目录下;  
  用法:  
  ab   -c   50   5000   http://localhost/index.php  
   
  在win2003下,好像最多支持50个并发测试。  
  在FREEBSD下,则没有限制。Top

3 楼pswdf(小邪)回复于 2006-03-13 10:22:23 得分 60

apache已经带了一个测试工具:   ab    
  一般把apache压力测试称为AB测试.   ab工具的位置在apache2的bin目录里.ab的使用是这样的:      
  $Content$nbsp;./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文件.    
   
  过一阵子结果就出来了,   我的机器慢,   过了好一阵子才出来   :)    
   
  $Content$nbsp;./ab   -c   100   -n   10000   http://127.0.0.1/index.php    
  This   is   ApacheBench,   Version   2.0.41-dev   <$Revision:   1.121.2.12   $Content$gt;   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)    
  Top

相关问题

  • 作好的网站用什么软件进行压力测试
  • 【问】:在.net里面怎么做Application Center Test项目压力测试??
  • 急问一个问题:怎么做一个数据库压力测试工具?
  • 关于用LoadRunner7.8给一个web程序作压力测试的问题
  • 本网站的大虾一般如果做压力测试的呢? 系统为linux+php+mysql+apache
  • jsp压力测试问题?
  • 对一台服务器进行压力测试,模拟数百个客户端并发运行,在通信上怎么实现啊
  • 请教压力测试的方法
  • 有谁做过ASP.NET的压力测试?
  • 关于压力测试的,请教:

关键词

  • 压力测试
  • apache
  • ab
  • attribute
  • 目录
  • header
  • number
  • content
  • requests

得分解答快速导航

  • 帖主:lib001
  • ice_berg16
  • Fufay
  • pswdf

相关链接

  • Web开发类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo