用AB对Webservice做压力测试

AB工具下载 

AB工具介绍见 web压力测试工具

 

下载ab工具后放到任意目录下,从命令行打开ab.exe

用AB对Webservice做压力测试_第1张图片

 

使用以下命令测试Webservice

ab -c 100 -n 1000 -p zip.txt -v 10 -T text/xml;charset=utf-8 http://localhost/myWebservice/zipcode.asmx?op=call

注:-c 并发请求数量  -n 本次测试总共请求数量  -v 打印出请求和返回信息的级别   -T xml格式的包需特别说明   -p Soap请求的Body部分文件存储路径

 

其中 zip.txt为webservice请求的包体,格式如:

xml version="1.0" encoding="utf-8" standalone="no"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:call xmlns:ns2="http://entry.ws.css.com/"> <arg0>湖北省武汉市东湖高新区arg0> ns2:call> soap:Body> soap:Envelope>

 

运行会得到并发测试结果:

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 192.168.1.17 (be patient).....done

Server Software:        Apache-Coyote/1.1
Server Hostname:        192.168.1.17
Server Port:            8080

Document Path:          /JYWebservice/EntryPort?op=call
Document Length:        1012 bytes

Concurrency Level:      100
Time taken for tests:   0.425 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      126500 bytes
Total POSTed:           55700
HTML transferred:       101200 bytes
Requests per second:    235.29 [#/sec] (mean)--------------------------------------- >吞吐率
Time per request:       425.000 [ms] (mean)--------------------------------------------->请求用户等待时间
Time per request:       4.250 [ms] (mean, across all concurrent requests)----->请求服务器处理时间(即吞吐率的倒数)
Transfer rate:          290.67 [Kbytes/sec] received
                        127.99 kb/s sent
                        418.66 kb/s total


Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.3      0       1
Processing:   318  386  22.6    393     423
Waiting:      317  385  22.7    392     422
Total:        318  386  22.6    393     424


Percentage of the requests served within a certain time (ms)
  50%    393
  66%    398
  75%    402
  80%    404
  90%    409
  95%    414
  98%    420
  99%    424
 100%    424 (longest request)

 

 

你可能感兴趣的:(用AB对Webservice做压力测试)