简述:

试用apache ab测试工具

下载点

http://httpd.apache.org/download.cgi

参考:

http://jingyan.baidu.com/article/e3c78d647a57833c4c85f502.html

ab的参数说明

-n  需要执行的请求次数

-c  并发的数量

-t   等待返回的最长时间

-b  TCP收发缓冲区的大小,单位(byte)

-p 使用post (同时需要定义-T参数)

-u 使用put (同时需要定义-T参数)

-T content-type, 例如application/x-www-form-urlencoded, 默认为text/plain

-w 把结果打印在html的表格里

-x  表格的属性

-y  tr行属性

-z  td列属性

-C 设置cookie 例如Apach=1234

-H header行, 例如Accept-Encoding:gzip

-k 是否标示位HTTP Keep Alive

步骤:

1. 配置环境变量

配置完成

2. 下面就拿apache的一个静态页面做测试

测试command,

  1. ab -n 1000 -c 100 -w http://localhost/a.htm >>C:\Users\Administrator\Desktop\ab_test\result.html

测试结果:

  1. This is ApacheBench, Version 2.3 <$Revision: 655654 $>
  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)
  5. Server Software:        Apache/2.2.25
  6. Server Hostname:        localhost
  7. Server Port:            80
  8. Document Path:          /a.htm
  9. Document Length:        319 bytes
  10. Concurrency Level:      100
  11. Time taken for tests:   0.325 seconds
  12. Complete requests:      1000
  13. Failed requests:        0
  14. Write errors:           0
  15. Total transferred:      581000 bytes
  16. HTML transferred:       319000 bytes
  17. Requests per second:    3076.74 [#/sec] (mean)
  18. Time per request:       32.502 [ms] (mean)
  19. Time per request:       0.325 [ms] (mean, across all concurrent requests)
  20. Transfer rate:          1745.69 [Kbytes/sec] received
  21. Connection Times (ms)
  22. min  mean[+/-sd] median   max
  23. Connect:        0    0   0.3      0       1
  24. Processing:    11   31   5.2     31      45
  25. Waiting:       11   31   5.2     30      45
  26. Total:         12   31   5.2     31      46
  27. Percentage of the requests served within a certain time (ms)
  28. 50%     31
  29. 66%     32
  30. 75%     33
  31. 80%     35
  32. 90%     38
  33. 95%     40
  34. 98%     42
  35. 99%     43
  36. 100%     46 (longest request)

附:

测试页面如下

下面是带参数的请求,

  1. ab -n 1000 -c 100 -p C:\Users\Administrator\Desktop\ab_test\params.txt -T application/x-www-form-urlencoded http://localhost/result.html >>C:\Users\Administrator\Desktop\ab_test\result.html

如果是带有cookie的请求

param.txt

  1. trainId=aaaa&topicCategory=b&topicRelation=a&userRoleCode=a1&searchText=

command:

  1. ab -n 10 -c 5 -p C:\Users\Administrator\Desktop\ab_test\params.txt -C "JSESSIONID=v1234hjwcx8k1e8trwh1ipjso; paramA=5322155; paramB=V12EE0186; edu.yale.its.tp.cas.client.filter.receipt=23/20/49/23/23/21/23/124/69/48/48/20/21/48/49/26/24/124/116/101/108/101/99/111/109/124/49/22/48/22/49/21/22/24/23/21/49/49/27/" -T application/x-www-form-urlencoded -w http://127.0.0.1:8080/cpa/topic/student/getTopicInfo >>C:\Users\Administrator\Desktop\ab_test\result.html

最后查看html的测试结果

测试结果:

Apache ab 测试工具使用(一)的更多相关文章

  1. Apache ab测试工具使用方法(无参、get传参、post传参)(转)

    转自Apache ab测试工具使用方法(无参.get传参.post传参) Ab测试工具是apache自带的测试工具,具有简单易上手的特性,下面我总结一下我的使用方法,首先去官方下载apache程序包, ...

  2. Apache ab测试工具使用方法(无参、get传参、post传参)

    Ab测试工具是apache自带的测试工具,具有简单易上手的特性,下面我总结一下我的使用方法,首先去官方下载apache程序包,我下的最新版本apache2.4.23,下载地址http://httpd. ...

  3. MAC系统上安装Apache ab测试工具

    第一步:下载 Apache HTTP Server http://httpd.apache.org/download.cgi#apache24 第二步:安装brew工具 https://brew.sh ...

  4. apache并发测试工具ab为什么测不准

    apache并发测试工具ab为什么测不准 发表于2年前(2013-03-21 12:13)   阅读(1146) | 评论(1) 1人收藏此文章, 我要收藏 赞0 3月21日 深圳 OSC 源创会正在 ...

  5. apache压力测试工具的apache bench和JMeter的安装

    Apache压力测试工具的安装 1,apache bench的安装 apache  bench工具集成在http的软件包内,可以直接安装apache就可以. 当有些时候,我们不需要用到所有的软件包,我 ...

  6. apache ab测试介绍

    apache ab测试介绍 安装ab命令 环境为ubuntu16.04.2 LTS,安装的命令为: sudo apt-get install apache2-utils 使用说明 格式为:ab [op ...

  7. Apache -- 压力测试工具ab.exe

    ab全称ApacheBench是Apache超文本传输协议(HTTP)的性能测试工具.是描绘当前所安装的Apache的执行性能, 主要是显示你安装的Apache每秒可以处理多少个请求Apache自带的 ...

  8. Centos6.5安装Apache ab性能测试工具

    ab简洁: ab是apache自带的压力测试工具,ab是apachebench命令的缩写. ab不仅可以对apache服务器进行网站访问压力测试,也可以对或其它类型的服务器进行压力测试. ab是一个h ...

  9. Apache ab 测试结果的分析

    以前安装好APACHE总是不知道该如何测试APACHE的性能,现在总算找到一个测试工具了.就是APACHE自带的测试工具AB(apache benchmark).在APACHE的bin目录下.格式: ...

随机推荐

  1. 系统级性能分析工具 — Perf

    从2.6.31内核开始,linux内核自带了一个性能分析工具perf,能够进行函数级与指令级的热点查找. perf Performance analysis tools for Linux. Perf ...

  2. [转]directsound抓取麦克风PCM数据封装类

    网上有很多方法从麦克风读取PCM数据,不想一一举例.只是在这里发布一个我自己写的directsound的麦克风PCM数据采集类,通过它,可以很方便的利用directsound技术把麦克风的数据采集到, ...

  3. Codeforces Round #149 (Div. 2) E. XOR on Segment (线段树成段更新+二进制)

    题目链接:http://codeforces.com/problemset/problem/242/E 给你n个数,m个操作,操作1是查询l到r之间的和,操作2是将l到r之间的每个数xor与x. 这题 ...

  4. c++地址对齐

    在一些计算机上,由于性能方面的原因,2个字节的变量,必须放在2的倍数的地址中,4个字节的,就必须放在4的倍数中的地址中,以此类推. 也就是说,如果有3个占用两个字节的变量,分别为:A,B,C,如下图: ...

  5. AlertView with password

    1. setAlertViewStyle:UIAlertViewStyleSecureTextInput UIAlertView *alertView = [[UIAlertView alloc] i ...

  6. [置顶] SNMP协议详解<二>

    上一篇文章讲解了SNMP的基本架构,本篇文章将重点分析SNMP报文,并对不同版本(SNMPv1.v2c.v3)进行区别! 四.SNMP协议数据单元 在SNMP管理中,管理站(NMS)和代理(Agent ...

  7. Cocos2d-x学习笔记(10)(CCMenu菜单)

    1.CCMenu创建方式 CCMenu* menu = CCMenu::create(cocos2d::CCMenuItem* item,--)參数为CCMenuItem菜单项的对象可变參数列表 2. ...

  8. poj 1338 Ugly Numbers(丑数模拟)

    转载请注明出处:viewmode=contents">http://blog.csdn.net/u012860063? viewmode=contents 题目链接:id=1338&q ...

  9. DataTable转换为List<Model>的通用类

    在开发中,把查询结果以DataTable返回很方便,但是在检索数据时又很麻烦,没有模型类型检索方便. 所以很多人都是按照以下方式做的: // 获得查询结果DataTable dt = DbHelper ...

  10. 用VS2010开发Android应用的配置方法

    在开发你的第一个Android应用程序之前,你应该先检查一下是否安装了Android SDK,以及是否创建好了Android模拟器(AVD),如果有不清楚的地方,请先看百度这篇文章“Android是什 ...