Apache安装包中自带的压力测试工具 Apache Benchmark(简称ab) 简单易用,这里就采用 ab作为压力测试工具了。

1.独立安装

ab运行需要依赖apr-util包,安装命令为:

1 yum install apr-util

安装依赖 yum-utils中的yumdownload 工具

如果没有找到 yumdownload 命令可以

1 yum install yum-utils

安装完成后执行以下指令

1 cd /opt
2 mkdir abtmp
3 cd abtmp
4 yum install yum-utils.noarch
5 yumdownloader httpd-tools*
6 rpm2cpio httpd-*.rpm | cpio -idmv

解开后就能得到独立的 ab可执行文件了。

操作完成后 将会产生一个 usr 目录 ab文件就在这个usr 目录中

 

2.参数详解

摘自: http://www.path8.net/tn/archives/5574
-n requests     Number of requests to perform
//在测试会话中所执行的请求个数。默认时,仅执行一个请求
-c concurrency Number of multiple requests to make
//一次产生的请求个数。默认是一次一个。
-t timelimit    Seconds to max. wait for responses
//测试所进行的最大秒数。其内部隐含值是 -n 50000。它可以使对服务器的测试限制在一个固定的总时间以内。默认时,没有时间限制。
-p postfile     File containing data to POST
//包含了需要POST 的数据的文件 .
-T content-type Content-type header for POSTing
//POST数据所使用的Content-type头信息。
-v verbosity    How much troubleshooting info to print
//设置显示信息的详细程度 - 4或更大值会显示头信息, 3或更大值可以显示响应代码 (404, 200等), 2或更大值可以显示警告和其他信息。 -V 显示版本号并退出。
-w              Print out results in HTML tables
//以HTML 表的格式输出结果。默认时,它是白色背景的两列宽度的一张表。
-i              Use HEAD instead of GET
// 执行HEAD 请求,而不是 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)
//-C cookie-name=value 对请求附加一个 Cookie:行。 其典型形式是 name=value的一个参数对。此参数可以重复。
-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.
//-P proxy-auth-username:password 对一个中转代理提供 BASIC认证信任。用户名和密码由一个 :隔开,并以base64 编码形式发送。无论服务器是否需要 (即, 是否发送了 401认证需求代码),此字符串都会被发送。
-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)
//-attributes 设置 属性的字符串 . 缺陷程序中有各种静态声明的固定长度的缓冲区。另外,对命令行参数、服务器的响应头和其他外部输入的解析也很简单,这可能会有不良后果。它没有完整地实现 HTTP/1.x; 仅接受某些' 预想'的响应格式。 strstr(3)的频繁使用可能会带来性能问题,即 , 你可能是在测试ab而不是服务器的性能。

3.输出解读

下面随便测试一个网页地址,来看下 ab输出的各项指标的含义。
===============================================================================
 
[root@server23 bin]# ./ab -n 100 -c 5 http://test.com
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
 
Benchmarking test.com (be patient).....done
 
Server Software:        nginx
Server Hostname:        test.com
Server Port:            80
 
Document Path:          /
Document Length:        0 bytes
 
Concurrency Level:      5
Time taken for tests:   1.559 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Non-2xx responses:      100
Total transferred:      21500 bytes
HTML transferred:       0 bytes
Requests per second:    64.15 [#/sec] (mean)
Time per request:       77.936 [ms] (mean)
Time per request:       15.587 [ms] (mean, across all concurrent requests)
Transfer rate:          13.47 [Kbytes/sec] received
 
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       36   37   0.7     37      39
Processing:    37   41   4.6     40      59
Waiting:       37   41   4.6     39      59
Total:         73   78   4.5     77      96
 
Percentage of the requests served within a certain time (ms)
  50%     77
  66%     78
  75%     79
  80%     79
  90%     81
  95%     95
  98%     95
  99%     96
 100%     96 (longest request)
 
===============================================================================
上面测试时用 -c 参数指定并发连接数为5,下面是关键指标含义的解释:

Time per request:       77.936 [ms] (mean)

每批请求处理完成的平均时间
Time per request:       15.587 [ms] (mean, across all concurrent requests)
       每个请求处理完成的平均时间 =每批完成时间77.936除以并发数 5
Requests per second:    64.15 [#/sec] (mean)
          每秒能处理的的请求数 =1000ms除以15.587
 
FROM: http://blog.woodbunny.com/post-139.html
 

[转] CentOS单独安装Apache Benchmark压力测试工具的办法的更多相关文章

  1. CentOS7单独安装Apache Bench压力测试工具

    用于并发测试. 1.安装 # need to run ab,apache portable runtime yum install apr-util # yum install yum-utils # ...

  2. Apache benchmark 压力测试工具

    ab 的全称是 ApacheBench , 是 Apache 附带的一个小工具 , 专门用于 HTTP Server 的 benchmark testing , 可以同时模拟多个并发请求. 安装apa ...

  3. MAC 安装 apache ab 压力测试工具以及遇到的坑

    ab 是apache对 http服务器进行压力测试的工具,它可以测试出服务器每秒可以处理多少请求.本文记录mac版本安装 ab 的步骤以及遇到的坑. 下载 进入 apache ab官网 下载页面. 安 ...

  4. Apache中压力测试工具ab的操作说明

    1.压力测试工具ab(ApacheBench)的简单说明 1)     网站性能压力测试是性能调优过程中必不可少的一环.只有让服务器处在高压情况下才能真正体现出各种设置所暴露的问题.Apache中有个 ...

  5. apache benchmark并发测试工具使用

    ab是apache自带的压力测试工具.ab非常实用,它不仅可以对apache服务器进行网站访问压力测试,也可以对或其它类型的服务器进行压力测试.比如nginx.tomcat.IIS等. 一.Apach ...

  6. CentOS7安装使用ab压力测试工具

    执行安装命令:yum -y install httpd-tools 安装完毕,执行:ab -help,显示命令参数 命令模板:ab -c 100 -n 10000 待测试网站(建议完整路径) -c 即 ...

  7. apache ab 压力测试工具

    Apache的ab命令模拟多线程并发请求,测试服务器负载压力,也可以测试nginx.lighthttp.IIS等其它Web服务器的压力.Apache附带的ab工具(使用的PHP环境是WAMP集成环境, ...

  8. 压力测试工具:apache bench(ab)

    作为php后端工程师,除了实现业务需求之外,需要考虑的就是自己写的服务,在大并发下是否能正常运行了,例如在我之前文章讲到的,在并发下,数据库查询可能会造成脏读幻读等情况,导致业务不正常. 但是,在一般 ...

  9. 压力测试工具ab及centos下单独安装方法 nginx和tomcat静态资源的性能测试

    Apache安装包中自带的压力测试工具Apache Benchmark(简称ab)简单易用,这里采用ab作为压国测试工具. 独立安装: ab运行需要信赖apr-util包: # yum install ...

随机推荐

  1. 转载:冷门js技巧

    前端已经被玩儿坏了!像console.log()可以向控制台输出图片等炫酷的玩意已经不是什么新闻了,像用||操作符给变量赋默认值也是人尽皆知的旧闻了,今天看到Quora上一个帖子,瞬间又GET了好多前 ...

  2. IOS 蓝牙相关-基础知识(1)

    蓝牙常见名称和缩写 MFI ======= make for ipad ,iphone, itouch 专们为苹果设备制作的设备 BLE ==== buletouch low energy,蓝牙4.0 ...

  3. Hibernate条件查询

    设计上可以灵活的根据 Criteria 的特点来方便地进行查询条件的组装.现在对 Hibernate的Criteria 的用法进行总结:Hibernate 设计了 CriteriaSpecificat ...

  4. Node.js的DES加解密和MD5加密

    最基本的就是经常用的md5加密算法 代码如下 var  MD5=function (data) {        var _encrymd5 = require('crypto').createHas ...

  5. 清除BOM头源码

    BOM: Byte Order Mark UTF-8 BOM又叫UTF-8 签名,其实UTF-8 的BOM对UFT-8没有作用,是为了支援UTF-16,UTF-32才加上的BOM,BOM签名的意思就是 ...

  6. phpMyAdmin:无法在发生错误时创建会话,请检查 PHP 或网站服务器日志,并正确配置 PHP 安装。

    一:错误提示 英文:Cannot start session without errors, please check errors given in your PHP and/or webserve ...

  7. HSV色彩空间

    HSV是把H(色相),S(饱和度),V(亮度)当做色值来定位颜色的空间.色相的取值范围是0~360度,用来表示颜色的类别.其中红色是0度,绿色是120度,蓝色是240度.饱和度的取值范围是0%~100 ...

  8. 新功能WBS

    项目名:连连看 组名:天天向上 组长:王森 组员:张政.张金生.林莉.胡丽娜 代码地址:HTTPS:https://git.coding.net/jx8zjs/llk.git SSH:git@git. ...

  9. Debug阶段成员贡献分

    组名:天天向上 组长:王森 组员:张政.张金生.林莉.胡丽娜 Debug阶段各组员的贡献分分配如下: 姓名 个人工作量 组长评价 个人评价 团队贡献总分 张金生 11 7 6 6.00 张政 11 6 ...

  10. GFS文件系统和在RedHat Linux下的配置

    GFS的全称是Google file System,为了满足Google迅速增长的数据处理要求,Google设计并实现的Google文件系统(GFS).Google文件系统是一个可扩展的分布式文件系统 ...