ApacheAB测试笔记讲解Word格式.docx

上传人:b****3 文档编号:15855353 上传时间:2022-11-16 格式:DOCX 页数:12 大小:49.18KB
下载 相关 举报
ApacheAB测试笔记讲解Word格式.docx_第1页
第1页 / 共12页
ApacheAB测试笔记讲解Word格式.docx_第2页
第2页 / 共12页
ApacheAB测试笔记讲解Word格式.docx_第3页
第3页 / 共12页
ApacheAB测试笔记讲解Word格式.docx_第4页
第4页 / 共12页
ApacheAB测试笔记讲解Word格式.docx_第5页
第5页 / 共12页
点击查看更多>>
下载资源
资源描述

ApacheAB测试笔记讲解Word格式.docx

《ApacheAB测试笔记讲解Word格式.docx》由会员分享,可在线阅读,更多相关《ApacheAB测试笔记讲解Word格式.docx(12页珍藏版)》请在冰豆网上搜索。

ApacheAB测试笔记讲解Word格式.docx

默认时,仅执行一个请求

-cconcurrencyNumberofmultiplerequeststomake

//一次产生的请求个数。

默认是一次一个。

-ttimelimitSecondstomax.waitforresponses

//测试所进行的最大秒数。

其内部隐含值是-n50000。

它可以使对服务器的测试限制在一个固定的总时间以内。

默认时,没有时间限制。

(作用像WAS一样)

-ppostfileFilecontainingdatatoPOST

//包含了需要POST的数据的文件.

-Tcontent-typeContent-typeheaderforPOSTing

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

-vverbosityHowmuchtroubleshootinginfotoprint

//设置显示信息的详细程度-4或更大值会显示头信息,3或更大值可以显示响应代码(404,200等),2或更大值可以显示警告和其他信息。

-V显示版本号并退出。

-wPrintoutresultsinHTMLtables

//以HTML表的格式输出结果。

默认时,它是白色背景的两列宽度的一张表。

-iUseHEADinsteadofGET

//执行HEAD请求,而不是GET。

-xattributesStringtoinsertastableattributes

//

-yattributesStringtoinsertastrattributes

-zattributesStringtoinsertastdorthattributes

-CattributeAddcookie,eg.'

Apache=1234.(repeatable)

//-Ccookie-name=value对请求附加一个Cookie:

行。

其典型形式是name=value的一个参数对。

此参数可以重复。

-HattributeAddArbitraryheaderline,eg.'

Accept-Encoding:

gzip'

Insertedafterallnormalheaderlines.(repeatable)

-AattributeAddBasicWWWAuthentication,theattributes

areacolonseparatedusernameandpassword.

-PattributeAddBasicProxyAuthentication,theattributes

//-Pproxy-auth-username:

password对一个中转代理提供BASIC认证信任。

用户名和密码由一个:

隔开,并以base64编码形式发送。

无论服务器是否需要(即,是否发送了401认证需求代码),此字符串都会被发送。

-Xproxy:

portProxyserverandportnumbertouse

-VPrintversionnumberandexit

-kUseHTTPKeepAlivefeature

-dDonotshowpercentilesservedtable.

-SDonotshowconfidenceestimatorsandwarnings.

-gfilenameOutputcollecteddatatognuplotformatfile.

-efilenameOutputCSVfilewithpercentagesserved

-hDisplayusageinformation(thismessage)

//-attributes设置属性的字符串.缺陷程序中有各种静态声明的固定长度的缓冲区。

另外,对命令行参数、服务器的响应头和其他外部输入的解析也很简单,这可能会有不良后果。

它没有完整地实现HTTP/1.x;

仅接受某些'

预想'

的响应格式。

strstr(3)的频繁使用可能会带来性能问题,即,你可能是在测试ab而不是服务器的性能。

参数很多,一般我们用-c和-n参数就可以了.例如:

./ab-c1000-n1000http:

//127.0.0.1/index.php

这个表示同时处理1000个请求并运行1000次index.php文件.

#/usr/local/xiaobai/apache2054/bin/ab-c1000-n1000http:

//127.0.0.1/index.html.zh-cn.gb2312

Benchmarking127.0.0.1(bepatient)

Completed100requests

Completed200requests

Completed300requests

Completed400requests

Completed500requests

Completed600requests

Completed700requests

Completed800requests

Completed900requests

Finished1000requests

ServerSoftware:

Apache/2.0.54

//平台apache版本2.0.54

ServerHostname:

127.0.0.1

//服务器主机名

ServerPort:

80

//服务器端口

DocumentPath:

/index.html.zh-cn.gb2312

//测试的页面文档

DocumentLength:

1018bytes

//文档大小

ConcurrencyLevel:

1000

//并发数

Timetakenfortests:

8.188731seconds

//整个测试持续的时间

Completerequests:

//完成的请求数量

Failedrequests:

0

//失败的请求数量

Writeerrors:

Totaltransferred:

1361581bytes

//整个场景中的网络传输量

HTMLtransferred:

1055666bytes

//整个场景中的HTML内容传输量

Requestspersecond:

122.12[#/sec](mean)

//大家最关心的指标之一,相当于LR中的每秒事务数,后面括号中的mean表示这是一个平均值

Timeperrequest:

8188.731[ms](mean)

//大家最关心的指标之二,相当于LR中的平均事务响应时间,后面括号中的mean表示这是一个平均值

8.189[ms](mean,acrossallconcurrentrequests)

//每个请求实际运行时间的平均值

Transferrate:

162.30[Kbytes/sec]received

//平均每秒网络上的流量,可以帮助排除是否存在网络流量过大导致响应时间延长的问题

ConnectionTimes(ms)

minmean[+/-sd]medianmax

Connect:

46461078.7893291

Processing:

165992493.19384712

Waiting:

118934480.68824554

Total:

81316381338.910937785

//网络上消耗的时间的分解,各项数据的具体算法还不是很清楚

Percentageoftherequestsservedwithinacertaintime(ms)

50%1093

66%1247

75%1373

80%1493

90%4061

95%4398

98%5608

99%7368

100%7785(longestrequest)

//整个场景中所有请求的响应情况。

在场景中每个请求都有一个响应时间,其中50%的用户响应时间小于1093毫秒,60%的用户响应时间小于1247毫秒,最大的响应时间小于7785毫秒

由于对于并发请求,cpu实际上并不是同时处理的,而是按照每个请求获得的时间片逐个轮转处理的,所以基本上第一个Timeperrequest时间约等于第二个Timeperrequest时间乘以并发请求数

2.Apacheab压力测试常用的方法

(0)ab-ttimelimit可以像WAS一样指定压力测试时间.

(1)ab测试-加入请求头属性:

(2)ab测试-把短连接变成长连接测试:

ab-n10-c10-khttp:

//localhost/

长连接测试时不行,30秒就timeout了。

(3)ab测试--把默认的get请求变成post请求:

ab-n10-c10-pd:

/night.txt–T'

application/x-www-form-urlencoded'

http:

说明:

ab还提供了POST方式的测试,要post出去的参数信息需要从一个外部文件读入:

在本地生成post.txt文件,内容为param1=abc&

param2=def

同时需要设置contentType,使用参数-T,并设置参数值为

application/x-www-form-urlencoded

完整的abpost测试命令如下:

ab-n1-ppost.txt-T‘application/x-www-form-urlencoded’http:

//192.168.0.2/test.js

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 法律文书 > 调解书

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1