前言:

ab是apache自带的压力测试工具,当安装完apache的时候,就可以在bin下面找到ab然后进行apache 负载压力测试。

工具:

Apache ab压测工具

一、安装

(1) 下载 : http://httpd.apache.org/

(2)解压

二、使用

(1) 选择 ab 文件位置  bin 下

Microsoft Windows [版本 10.0.16299.371]
(c) 2017 Microsoft Corporation。保留所有权利。

C:\Users\Eddie>E:

E:\>cd E:\Apache24\bin

E:\\Apache24\bin>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 at a time
     -t timelimit    Seconds to max. to spend on benchmarking
                     This implies -n 50000
     -s timeout      Seconds to max. wait for each response
                     Default is 30 seconds
     -b windowsize   Size of TCP send/receive buffer, in bytes
     -B address      Address to bind to when making outgoing connections
     -p postfile     File containing data to POST. Remember also to set -T
     -u putfile      File containing data to PUT. Remember also to set -T
     -T content-type Content-type header to use for POST/PUT data, eg.
                     'application/x-www-form-urlencoded'
                     Default is 'text/plain'
     -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.
     -q              Do not show progress when doing more than 150 requests
     -l              Accept variable document length (use this for dynamic pages)
     -g filename     Output collected data to gnuplot format file.
     -e filename     Output CSV file with percentages served
     -r              Don't exit on socket receive errors.
     -m method       Method name
     -h              Display usage information (this message)

翻译

格式: ./ab [options] [http://]hostname[:port]/path

Ab命令参数注释:

  -n    #指定在测试会话中所执行的请求个数。默认时,仅执行一个请求。 

  -c    #指定一次产生的请求个数。默认是一次一个。

  -t    #测试所进行的最大秒数。其内部隐含值是-n 50000。它可以使对服务器的测试限制在一个固定的总时间以内。默认时,没有时间限制。

  -p    #包含了需要POST的数据的文件.

  -T    #POST数据所使用的Content-type头信息。

  -v    #设置显示信息的详细程度 - 4或更大值会显示头信息, 3或更大值可以显示响应代码(404, 200等), 2或更大值可以显示警告和其他信息。 -V 显示版本号并退出。

  -w    #以HTML表的格式输出结果。默认时,它是白色背景的两列宽度的一张表。

  -I    #执行HEAD请求,而不是GET。

(2)压力测试

E:\Apache24\bin>ab -n 500 -c 100 http://127.0.0.1:8080/test/eddie/order/123456
This is ApacheBench, Version 2.3 <$Revision: 1826891 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Finished 500 requests

Server Software:
Server Hostname:        127.0.0.1
Server Port:            8080

Document Path:          /test/eddie/order/123456
Document Length:        109 bytes

Concurrency Level:      100
Time taken for tests:   50.755 seconds
Complete requests:      500
Failed requests:        491
    (Connect: 0, Receive: 0, Length: 491, Exceptions: 0)
Total transferred:      122392 bytes
HTML transferred:       55392 bytes
Requests per second:    9.85 [#/sec] (mean)
Time per request:       10151.063 [ms] (mean)
Time per request:       101.511 [ms] (mean, across all concurrent requests)
Transfer rate:          2.35 [Kbytes/sec] received

Connection Times (ms)
               min  mean[+/-sd] median   max
Connect:        0    1   0.5      1       3
Processing:   154 9024 5635.0   8417   19876
Waiting:      152 9023 5635.8   8416   19875
Total:        155 9025 5635.1   8418   19878

Percentage of the requests served within a certain time (ms)
   50%   8418
   66%  11432
   75%  13650
   80%  15025
   90%  17446
   95%  18675
   98%  19451
   99%  19675
  100%  19878 (longest request)

三、提示

(1) 需要安装 Microsoft Visual C++ xxxx Redistributable, 在下载 ab 页面哪里最低

(2)闪退?

{path}\Apache24\bin\ab.exe

答:只能使用 cmd 方式

【Apache】 ab进行压力测试的更多相关文章

  1. 使用Apache ab进行压力测试(参数说明)

    我们一般会使用Apache自带的ab来对项目进行压力测试,看项目的执行情况如何. 我们可以使用 ab -v 来查看ab的详细参数使用方法. [root@node234 bin]# ./ab -v ab ...

  2. Apache ab参数--压力测试

    Apache附带的ab,它非常容易使用,ab可以直接在Web服务器本地发起测试请求.这至关重要,因为我们希望测试的服务器的处理时间,而不包含数据的网络传输时间以及用户PC本地的计算时间. 需要清楚的是 ...

  3. Apache自带压力测试工具ab用法简介

    ab命令原理 ab命令会创建很多的并发访问线程,模拟多个访问者同时对某一URL进行访问.它的测试目标是基于URL的,因此,既可以用来测试Apache的负载压力,也可以测试nginx.lighthttp ...

  4. PHP性能:序——谈ab(Apache Bench)压力测试工具

    PHP性能:序——谈ab(Apache Bench)压力测试工具 ab(Apache  Bench)是啥? ab是Apache自带的一个压力测试软件,可以通过ab命令和选项对某个URL进行压力测试.a ...

  5. 转:PHP性能:序——谈ab(Apache Bench)压力测试工具

    PHP性能:序——谈ab(Apache Bench)压力测试工具 ab(Apache  Bench)是啥? ab是Apache自带的一个压力测试软件,可以通过ab命令和选项对某个URL进行压力测试.a ...

  6. 开源的类似于Apache ab的压力测试命令行工具SuperBenchmarker

    SuperBenchmarker 是ㄧ个开源的类似于Apache ab的压力测试命令行工具.可以在 .NET 4.52+ 或者 .NET Core 2.0+ 平台上运行. 可支持Get.Post.Pu ...

  7. 使用Apache Benchmark做压力测试遇上的5个常见问题

    这一篇文章主要记录我在使用Apache Benchmark(一下检测ab)做网站压力测试的过程中,遇到的一些问题以及解决办法,方便日后使用. 这一篇文章主要记录我在使用Apache Benchmark ...

  8. kubernetes:基于ab的压力测试

    基于ab的压力测试 # cat apache-test.yaml ################################################################### ...

  9. 使用Apache的ab进行压力测试

    概述 ab是apache自带的压力测试工具,当安装完apache的时候,就可以在bin下面找到ab然后进行apache 负载压力测试. 后台测试开发中,常用的压力测试服务,php一般选择xampp,下 ...

  10. Apache自带压力测试工具----linux环境中ab命令简介及结果分析

    ab(apache bench)是apache下的一个工具,主要用于对web站点做压力测试, 基础用法: 其中-c选项为一次发送的请求数量,及并发量.-n选项为请求次数. 实验测试: [dev@web ...

随机推荐

  1. ZT 9种排序

    9种排序 2012-09-19 14:58 66人阅读 评论(0) 收藏 编辑 删除 algorithmfpfilemergeintegerfloat [cpp] view plaincopy #in ...

  2. 你的ABAP程序给佛祖开过光么?来试试Jerry这个小技巧

    最近Jerry在忙一个项目,技术栈换成了nodejs平台,语言换成了JavaScript,因为赶项目进度,一直没时间更新公众号.感谢大家的支持,关注人数还是慢慢地增长到了3000. 今天我们来聊聊一个 ...

  3. 学习python第五天进制转换

    6.进制之间的转换(重要) 二进制:满二进一 范围:0.1符号:0b例如:0b10...[注意]计算机只能识别二进制数据 八进制:满八进一 范围:0~7符号:0o例如:0o66 十进制:满十进一 范围 ...

  4. BZOJ4517:[SDOI2016]排列计数(组合数学,错排公式)

    Description 求有多少种长度为 n 的序列 A,满足以下条件: 1 ~ n 这 n 个数在序列中各出现了一次 若第 i 个数 A[i] 的值为 i,则称 i 是稳定的.序列恰好有 m 个数是 ...

  5. 2668: [cqoi2012]交换棋子

    Description 有一个n行m列的黑白棋盘,你每次可以交换两个相邻格子(相邻是指有公共边或公共顶点)中的棋子,最终达到目标状态.要求第i行第j列的格子只能参与mi,j次交换. Input 第一行 ...

  6. 【转】彻底理解android中的内部存储与外部存储

    我们先来考虑这样一个问题: 打开手机设置,选择应用管理,选择任意一个App,然后你会看到两个按钮,一个是清除缓存,另一个是清除数据,那么当我们点击清除缓存的时候清除的是哪里的数据?当我们点击清除数据的 ...

  7. mongodb的学习-1-NoSQL

    菜鸟教程的学习笔记-http://www.runoob.com/mongodb/nosql.html 关系型数据库遵循ACID规则 事务在英文中是transaction,和现实世界中的交易很类似,它有 ...

  8. 图片 和 base64 互转

    图片转base64 NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlStr]]; UIImage *img = ...

  9. pyhton 面向对象之 小明左右手换牌

    '''#左右手交换牌 案列#小明手里有俩张牌,左手红桃♥K,右手黑桃♠A,小明交换俩手的牌后,手里分别是什么? 人类:    属性:小明,左手,右手    行为:展示手里的牌, 交换手里的牌手类:   ...

  10. 关于HBase Shell命令基本操作示例

    HBase 为用户提供了一个非常方便的使用方式, 我们称之为“HBase Shell”. HBase Shell 提供了大多数的 HBase 命令, 通过 HBase Shell 用户可以方便地创建. ...