AB工具下載 css
AB工具介紹見 web壓力測試工具html
下載ab工具後放到任意目錄下,從命令行打開ab.exeweb
使用如下命令測試Webserviceapache
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)