`

ApacheBench(ab)使用简介

阅读更多

轉載於:  http://blog.csdn.net/lucyii/archive/2008/02/19/2105687.aspx

 

ApacheBench 主要是用来测试阿帕奇服务器执行效率用的。安装好 apache 服务器套件后,进入 bin 目录,就可以找到该可执行文件 ab.exe

         ApacheBench 可以针对某一特定 URL 模拟出连续的联机请求,同时还可以仿真出同时间点个数相同的联机请求,因而利用 ApacheBench 可帮助我们在网站开发期间仿真实际上线可能的情况,利用仿真出来的数据做为调整服务器设定或程序的依据。
ab 用法如下
Usage: ab [options] [http[s]://]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
    -s              Use httpS instead of HTTP (SSL)
    -h              Display usage information (this message)

 

基本用法 :

ab -n
全部请求数 -c 并发数 测试 url


:ab -n 1000 -c 50 http://www.abc.com/a.php

得到结果类似于 ( 后面颜色字为中文翻译 ):

Server Software:        Apache/2.0.55
Server Hostname:        localhost
Server Port:            80

Document Path:          /1.php
Document Length:        82522 bytes  #
请求文档大小

Concurrency Level:      50           #
并发数  
Time taken for tests:   92.76140 seconds #
全部请求完成耗时
Complete requests:      10000          #
全部请求数
Failed requests:        1974           #
失败的请求
  (Connect: 0, Length: 1974, Exceptions: 0)
Write errors:           0
Total transferred:      827019400 bytes   #
总传输大小
HTML transferred:       825219400 bytes
Requests per second:    108.61 [#/sec] (mean)   #
每秒请求数 ( 平均 )
Time per request:       460.381 [ms] (mean)   #
每次并发请求时间 ( 所有并发 )
Time per request:       9.208 [ms] (mean, across all concurrent requests)   #
每一请求时间 ( 并发平均 )  
Transfer rate:          8771.39 [Kbytes/sec] received    #
传输速率

Connection Times (ms)    #
连接时间
             min  mean[+/-sd] median   max
Connect(#
连接 ):        0    0   2.1      0      46
Processing(#
处理 ):    31  458  94.7    438    1078
Waiting(#
等待 ):       15  437  87.5    422     938
Total:         31  458  94.7    438    1078


其它参数 :

-n requests    
全部请求数
-c concurrency  
并发数
-t timelimit    
最传等待回应时间
-p postfile     POST
数据文件
-T content-type POST Content-type
-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    
加入 cookie, eg. 'Apache=1234. (repeatable)
-H attribute    
加入 http , eg. 'Accept-Encoding: gzip'
                Inserted after all normal header lines. (repeatable)
-A attribute    http
验证 , 分隔传递用户名及密码
-P attribute    Add Basic Proxy Authentication, the attributes
                are a colon separated username and password.
-X proxy:port  
代理服务器
-V              
查看 ab 版本
-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)

分享到:
评论

相关推荐

    ApacheBench 64位

    **使用ApacheBench进行压力测试** 使用ab进行压力测试非常简单,基本语法如下: ```bash ab -n <number_of_requests> -c <concurrency_level> ``` - `-n` 参数指定了要发送的请求数。 - `-c` 参数指定了并发用户的...

    ApacheBench压力测试工具DYF

    **ApacheBench基本使用** ApacheBench,通常简称为`ab`,通过命令行方式进行操作。其基本语法如下: ```bash ab [选项] [URL] ``` 其中,`选项`包括但不限于: - `-n`:指定请求总数,即要执行的HTTP请求的数量...

    Golang_GoHTTP负载生成器ApacheBench ab替代.zip

    ApacheBench(ab)是一个广泛使用的命令行工具,用于对Web服务器进行负载和压力测试。然而,随着技术的发展,Go语言以其高效的性能和简洁的语法,逐渐成为构建高性能网络服务的首选。本资源包“Golang_GoHTTP负载...

    性能测试ab(ApacheBench)的应用

    **性能测试ab(ApacheBench)的应用** ApacheBench,简称ab,是Apache HTTP服务器自带的一款简单而强大的性能测试工具。它可以帮助我们评估Web服务器的性能,通过模拟多个并发用户请求来测试服务器的响应时间、吞吐量...

    ApacheBench(压力测试)

    ApacheBench,简称ab,是一款由Apache服务器项目提供的轻量级压力测试工具。它主要用于评估Web服务器的性能,通过对服务器发送HTTP请求来模拟用户负载,从而分析服务器在一定压力下的处理能力。以下是对ApacheBench...

    ApacheBench测试详解

    ApacheBench(简称ab)是一款由Apache HTTP服务器项目提供的轻量级性能测试工具。它能够模拟多个并发用户对指定Web服务器进行请求,从而评估服务器的性能和稳定性。这个工具对于系统管理员和开发者来说非常实用,...

    apache-bench压力测试

    【Apache Bench简介】 Apache Bench(ab)是一个轻量级的性能测试工具,它通过模拟多个并发用户发送HTTP请求来测试服务器的性能。它能测量服务器处理请求的速度和稳定性,提供每秒事务率(Requests per second)、...

    Windows下的ApacheBench

    Windows下的ApacheBench。网站压力测试神器。

    ApacheBench压力并发测试

    **一、ApacheBench的基本使用** 1. **命令格式**:`ab [options] [http://]hostname[:port]/path` 这里的`[options]`是一系列可选参数,用来定制测试行为,如并发用户数、请求次数等;`[http://]hostname[:port]/...

    网页并发测试小工具ApacheBench

    ApacheBench,简称ab,是Apache HTTP服务器自带的一款性能测试工具,主要用来对Web服务器进行基准测试,评估其处理并发请求的能力。它可以帮助系统管理员、开发者或者网站所有者了解服务器在高负载情况下的表现,...

    Go-替代ApacheBench(ab)的HTTP负载生成器

    标题中的“Go-替代ApacheBench(ab)的HTTP负载生成器”指的是使用Go语言编写的一种工具,它能够替代传统的ApacheBench(ab)工具来执行HTTP负载测试。ApacheBench是一款广泛使用的命令行工具,用于测量Web服务器的...

    apache_ab使用说明

    Apache Bench(ab)是Apache HTTP服务器自带的一个简单压力测试工具,用于评估Web服务器的性能。它可以帮助管理员了解服务器在高并发请求下的响应速度和稳定性。在这个例子中,我们看到两个不同的测试场景,一个是...

    Apache Bench

    ApacheBench 是 Apache 服务器自带的一个web压力测试工具,简称ab。ab又是一个命令行工具,对发起负载的本机要求很低,根据ab命令可以创建很多的并发访问线程,模拟多个访问者同时对某一URL地址进行访问,因此可以...

    window10本地电脑使用Apache Bench简称(ab)工具进行web端网站测试

    使用Apache Bench工具进行网站压力测试 下载我们需要的测试工具(ab)到你的电脑中apache bench工具下载地址 将下好的压缩包放在你的任意磁盘中,并解压出压缩包里的,我是解压缩到了D盘中 使用window10命令行工具...

    apache ab测试程序

    AB,全称ApacheBench,能够模拟多个并发用户对Web服务器进行请求,从而分析服务器在高负载下的响应时间和吞吐量。 在Windows环境下,你可以通过以下步骤来运行AB测试: 1. 首先,你需要找到`ab.exe`文件,这通常...

    如何通过Apache Bench实现web压力测试

     ApacheBench 是 Apache 服务器自带的一个web压力测试工具,简称ab。ab又是一个命令行工具,对发起负载的本机要求很低,根据ab命令可以创建很多的并发访问线程,模拟多个访问者同时对某一URL地址进行访问,因此可以...

    hey, HTTP负载生成器,ApacheBench ( ab ) 替换,以前称为 rakyll/boom.zip

    hey, HTTP负载生成器,ApacheBench ( ab ) 替换,以前称为 rakyll/boom 嘿,是一个小程序,向web应用程序发送一些负载。最初被称为 boom,受到Tarek工具的影响,在 tarekziade/boom 。 使用相同的名称是一个错误,...

    CentOS环境下单独安装apachebench的方法

    本文实例讲述了CentOS环境下单独安装apachebench的方法。分享给大家供大家参考,具体如下: 这两天在测试php性能优化方法。 为了做压力测试可观察效果,就选择了ApacheBench来作为压力测试工具。其实就是大家常说的...

Global site tag (gtag.js) - Google Analytics