压力测试

来源:互联网 发布:hive sql select top 编辑:程序博客网 时间:2024/04/29 07:08


ab:Apache Bench

参考:

http://www.cnblogs.com/jackei/archive/2006/07/18/454144.html

简单易用,免费!相比LR而言

1 命令选项
  • -A auth-username:password
  • -c concurrency Number of multiple requests to perform at a time. Default is one request at a time.
  • -C cookie-name=value  Add a Cookie: line to the request. The argument is typically in the form of a name=value pair. This field is repeatable.
  • -d  Do not display the "percentage served within XX [ms] table". (legacy support).
  • -e csv-file  Write a Comma separated value (CSV) file which contains for each percentage (from 1% to 100%) the time (in milliseconds) it took to serve that percentage of the requests. 
  • -g gnuplot-file  Write all measured values out as a 'gnuplot' or TSV (Tab separate values) file. This file can easily be imported into packages like Gnuplot, IDL, Mathematica, Igor or even Excel.
  • -h Display usage information.
  • -H custom-header  Append extra headers to the request
  • -i Do HEAD requests instead of GET.
  • -k  Enable the HTTP KeepAlive feature, i.e., perform multiple requests within one HTTP session. Default is no KeepAlive.
  • -n requests  Number of requests to perform for the benchmarking session. 
  • -p POST-file  File containing data to POST.
  • -P proxy-auth-username:password
  • -q  When processing more than 150 requests, ab outputs a progress count on stderr every 10% or 100 requests or so. The -q flag will suppress these messages.
  • -s  When compiled in (ab -h will show you) use the SSL protected https rather than the http protocol.
  • -S  Do not display the median and standard deviation values, nor display the warning/error messages
  • -t timelimit  Maximum number of seconds to spend for benchmarking. This implies a -n 50000 internally.
  • -T content-type  Content-type header to use for POST data.
  • -v verbosity  Set verbosity level - 4 and above prints information on headers, 3 and above prints response codes (404, 200, etc.), 2 and above prints warnings and info.
  • -V  Display version number and exit.
  • -w  Print out results in HTML tables. Default table is two columns wide, with a white background.
  • -x <table>-attributes  String to use as attributes for <table>. Attributes are inserted <table here >.
  • -X proxy[:port] Use a proxy server for the requests.
  • -y <tr>-attributes  String to use as attributes for <tr>.
  • -z <td>-attributes  String to use as attributes for <td>.

其中-n和-c是常用的。-k选项在介绍长连接提升Web性能中有讲。

2 结果分析

ab -n 10000 -c 1000 http://api.feifeiapp.com/

This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking api.feifeiapp.com (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software: nginx/1.2.6
Server Hostname: api.feifeiapp.com
Server Port: 80

Document Path: /
Document Length: 440 bytes

Concurrency Level: 1000
Time taken for tests: 7.867 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 6610000 bytes
HTML transferred: 4400000 bytes
Requests per second: 1271.14 [#/sec] (mean)   每秒处理请求数
Time per request: 786.697 [ms] (mean)   每个请求响应时间
Time per request: 0.787 [ms] (mean, across all concurrent requests)
Transfer rate: 820.53 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 1 42 186.9 5 1014
Processing: 1 54 414.5 6 7842
Waiting: 1 54 414.5 6 7842
Total: 2 97 461.5 12 7850

Percentage of the requests served within a certain time (ms)
50% 12
66% 19
75% 21
80% 27
90% 31
95% 929
98% 1026
99% 1858
100% 7850 (longest request)


aj:Apache JMeter

参考:

http://blog.csdn.net/yjflinchong/article/details/7853928

http://www.ibm.com/developerworks/cn/java/l-jmeter/

使用手册:JMETER.doc

100%纯Java应用程序并且能够正确的在任何有适当的Java实现的操作系统上运行

1 安装

打开软件中心,搜索JMeter即可安装,大约111M

2 ...

原创粉丝点击