web页面与java websocket接口的压力测试



web页面访问压力测试工具可以使用apache自带的ab命令进行检测;java websocket接口的压力测试可以使用Jmeter+websocket插件进行检测。


一、         下载软件


二、         进入软件路径


三、         获取ab指令参数列表

执行“ab help

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.
                    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)

四、         进行web压力测试

执行“ab -n 1000 -c
100 http://www.baidu.com/index.html

五、         报表结果

Server Software:        Apache/2.4.7
Server Hostname:        www.3elearn.com.cn
Server Port:            80
Document Path:          /index.html
Document Length:        16300 bytes
Concurrency Level:      100
Time taken for tests:   26.931 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      16573000 bytes
HTML transferred:       16300000 bytes
Requests per second:    37.13 [#/sec] (mean)
Time per request:       2693.147 [ms] (mean)
Time per request:       26.931 [ms] (mean, across all concurrent requests)
Transfer rate:          600.95 [Kbytes/sec] received
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        9   27   9.1     26      51
Processing:    50 2532 466.3   2659    2740
Waiting:       27 1325 769.3   1330    2649
Total:         80 2559 466.1   2687    2776
Percentage of the requests served within a certain time (ms)
  50%   2687
  66%   2704
  75%   2714
  80%   2718
  90%   2730
  95%   2739
  98%   2749
  99%   2754
 100%   2776 (longest request)


一、         下载


二、         安装



三、         安装websokcet插件





四、         使用

a)    添加线程组


b)    添加websocket

在“线程组”——“添加”——“sample”——“websocket sample

c)     添加结果树


© 2015, 李德涛博客. 版权所有.