zoukankan      html  css  js  c++  java
  • 用AB对Webservice做压力测试

    AB工具下载 

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

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

    使用以下命令测试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)
  • 相关阅读:
    2017——我们为什么选择JAVA?JAVA的发展方向和学习方法(必看)
    Java
    4中引用(强,软,弱,虚)侧重弱引用
    面试常见问题
    一个牛人给java初学者的建议
    java转换图片压缩生成webp格式
    JVM-String常量池与运行时常量池
    轮滑基础(一)(前摔,葫芦步,推步,A字转弯,弓步转弯)
    单词本
    可空值 DateTime? ToString("yy-MM-dd")
  • 原文地址:https://www.cnblogs.com/tuyile006/p/3635323.html
Copyright © 2011-2022 走看看