IDO老徐,在深圳,某上市公司质量部负责人,干了十二年软件测试,公号"简尚" ,博客isTester.com ,关注「软件测试从业者综合能力提升」,微信957863300

推荐:Apache 压力测试工具ab

上一篇 / 下一篇  2016-03-29 19:06:25 / 个人分类:测试工具

51Testing软件测试网HnnD,X2BHy

!INP0AQ0^{ r0
关于压力测试
很多同学只知道LR、jmeter

/`4[V$y&tr0

在 Apache 有个叫 ab(ApacheBench) 的程序, 此程序是专门用在做压力测试用的软件. ApacheBench(ab) 用来测试 apache 执行效率,可以用来测试网站的压力工具.

8cGZ!?/S)M0

ab 参数

[h)tf1Uh+Cd0

ab 参数:

8V/@ Wr.U{(V0

Usage: /usr/sbin/ab [options] [http[s]://]hostname[:port]/path

BGy;iq,Y0

Options are:51Testing软件测试网9F*MhFm c k

§ -n requests Number of requests to perform

G O'a1ju0

§ -c concurrency Number of multiple requests to make51Testing软件测试网]#z&W{,]E

§ -t timelimit Seconds to max. wait for responses51Testing软件测试网9M [XdP;N3`6Dv'a

§ -p postfile File containg data to POST51Testing软件测试网b:^.K/{vW"{

§ -T content-type Content-type header for POSTing

R7~!^?8``(n0

§ -v verbosity How much troubleshooting info to print

m?+P:o|'Lq$J/d0

§ -w Print out results in HTML tables51Testing软件测试网j*R$V4Ds2o[(?9W/y.Oi+x

§ -i Use HEAD instead of GET51Testing软件测试网'vW~S#Gya

§ -x attributes String to insert as table attributes

r-dy4L(gV0

§ -y attributes String to insert as tr attributes51Testing软件测试网t-Sz![p"VkT!F Hu

§ -z attributes String to insert as td or th attributes51Testing软件测试网7rT/]kq^5w4G:[-|\b

§ -C attribute Add cookie, eg. 'Apache=1234' (repeatable)51Testing软件测试网;|A;iyV$X

§ -H attribute Add Arbitrary header line, eg. 'Accept-Encoding: zop'51Testing软件测试网D Z6TuJb

§ Inserted after all normal header lines. (repeatable)

Wg)K KRx4q#zm0

§ -A attribute Add Basic WWW Authentication, the attributes

9Aams#{H0

§ are a colon separated username and password.51Testing软件测试网z,ai'C]#^z(s

§ -P attribute Add Basic Proxy Authentication, the attributes51Testing软件测试网5e3l2S6? o

§ are a colon separated username and password.

i4??P2~2m0

§ -X proxy:port Proxyserver and port number to use51Testing软件测试网2e;@l `%j3d

§ -V Print version number and exit51Testing软件测试网q[ E L0DR%^

§ -k Use HTTP KeepAlive feature51Testing软件测试网6C5c&Vy)K

§ -d Do not show percentiles served table.

3iP^KT:u0

§ -S Do not show confidence estimators and warnings.

Z[w MJ h)_0

§ -g filename Output collected data to gnuplot format file.

"o1j"\8e xi2q0

§ -e filename Output CSV file with percentages served51Testing软件测试网-L3x#PGiu3h\]

§ -s Use httpS instead of HTTP (SSL)

$JX%\%e)T5{Kr2J0

§ -h Display usage information (this message)51Testing软件测试网8u+o`I,j,q7I

ab 使用

JB?OJh2_0

ab使用范例: 

+T2X!|8B?.wl-B Vm0

要执行 1000 次的 connection, 20 次的 concurrent (并行, 同时):

/]:J5F(s0c B jA0

语法: ab -n 1000 -c 20 http://localhost/51Testing软件测试网a e8|;J)Q3b5C}1tP

产生出来的结果. 要注意的是以下几个:51Testing软件测试网&Pi*I)M P4I$@V S|&Aw

§ Time taken for tests: 总共执行花了多久的时间.(以上 1000 次共多久)51Testing软件测试网J)KO/Kt;z.}n

§ Requests per second: 每秒平均可以处理多少个 connection.

`5nR~sYKG0


8of0y\Dj~J#w051Testing软件测试网2z%Px&P3{5I8Z


具体有兴趣,大家可以研究下

Y0^!k1l%]1p-NL:\0
ab 可运行在linux  & windows平台~
51Testing软件测试网ogS/R-a
51Testing软件测试网b]u!@9g%~(X8u'~7g
51Testing软件测试网4yr9t#F,l @'v

e"Z kD4h8N"qq(V8P0
最后,
apache的ab工具也算是一种ddos攻击工具

TAG: 性能测试工具 软件测试 压力测试

 

评分:0

我来说两句

xuquan

xuquan

IDO老徐,坐标深圳,测试经理,干了十年测试,公号"简尚" ,个人博客isTester.com ,关注「软件测试从业者综合能力提升」,微信957863300

日历

« 2024-05-03  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 915715
  • 日志数: 427
  • 建立时间: 2012-06-04
  • 更新时间: 2022-02-23

RSS订阅

Open Toolbar