qileilove

          blog已經轉移至github,大家請訪問 http://qaseven.github.io/

          使用Siege測試Web服務器

           好處是可以對一組url進行測試
            參見 http://www.aygfsteel.com/crespochen/archive/2009/06/02/279573.html 和 http://baike.baidu.com/link?url=Uv0KtwM83hvFTjudQsP37FIfeUDJxMW4Kvodfk6oSTJ4B4ctpr1R6P4CGXdyMExyU7rGL2bold_aGJHwKaV2l_
            郭揚提供了1.73上的應用,拷貝到/guodian/uap2,部署上Weblogic的Server-0(端口號是7010)。uap2依賴于uap_server。通過http訪問是
            查詢
            http://192.168.1.73:7010/sguap-client/SmallCase/rest/smallCase/
            增加:
            http://192.168.1.73:7010/sguap-client/SmallCase/rest/smallCase/insert?uuid=XXX&name=XXX
            修改:
            http://192.168.1.73:7010/sguap-client/SmallCase/rest/smallCase/update?uuid=XXX&name=XXX
            刪除
            http://192.168.1.73:7010/sguap-client/SmallCase/rest/smallCase/delete?uuid=XXX
            我們在1.74上做測試。
            yum -y install siege #安裝siege,安裝不上的話,就從前面提供的URL上下載siege,再安裝。
            據此,寫了個shell生成url
          #!/bin/bashfunction get_random_name(){MATRIX="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"LENGTH=8while[${n:=1}-le$LENGTH]; doPASS="$PASS${MATRIX:$(($RANDOM%${#MATRIX})):1}"let n+=1doneecho$PASS}function make_link(){act=$1#echo $actfor i in$seqc; do#echo $i
          linkarr[$i]="\$link/$act?uuid=${idarr[$i]}&name=$(get_random_name)"echo${linkarr[$i]}>>$outdone}num=$1out=$2[ x$num = x ]&&num=10[ x$out = x ]&&out=link.out
          link=http://192.168.1.73:7010/sguap-client/SmallCase/rest/smallCase
          declare-a idarr
          seqc=`seq$num`for i in$seqc; do
          idarr[$i]=$[$RANDOM%1000]doneecholink=$link>$outecho${idarr[@]}declare-a linkarr
          $(make_link insert);
          echo \$link/>>$outecho>>$out
          $(make_link update);
          echo \$link/>>$outecho>>$out
          $(make_link delete);
          echo \$link/>>$outecho>>$out
            測試命令
            siege -c20 -r2 -f link.out
            參數說明:
            -c20 并發20個用戶
            -r2 重復循環2次
            -f link.out 任務列表:URL列表
            測試結果:
          ** SIEGE 3.0.0
          ** Preparing 20 concurrent users for battle.
          The server is now under siege...
          HTTP/1.1 200   0.37 secs:     340 bytes ==> GET  /sguap-client/SmallCase/rest/smallCase/insert
          HTTP/1.1 200   0.38 secs:     340 bytes ==> GET  /sguap-client/SmallCase/rest/smallCase/insert
          ...............................................  #代替很多條HTTP/1.1 ...
          Transactions:          40 hits
          Availability:      100.00 %
          Elapsed time:        2.14 secs
          Data transferred:        0.01 MB
          Response time:        0.21 secs
          Transaction rate:       18.69 trans/sec
          Throughput:        0.01 MB/sec
          Concurrency:        3.87
          Successful transactions:          40
          Failed transactions:           0
          Longest transaction:        0.58
          Shortest transaction:        0.00
            Concurrency是并發數
            siege還包含了一些輔助工具:bombardment,是一個輔助工具:用于按照增量用戶壓力測試。
            bombardment link.out 5 5 10 1
            這樣測試,效果也良好,就是費時間。

          posted on 2014-09-12 10:06 順其自然EVO 閱讀(196) 評論(0)  編輯  收藏 所屬分類: 測試學習專欄

          <2014年9月>
          31123456
          78910111213
          14151617181920
          21222324252627
          2829301234
          567891011

          導航

          統計

          常用鏈接

          留言簿(55)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 江达县| 徐汇区| 海兴县| 工布江达县| 泗水县| 龙海市| 南华县| 青州市| 康乐县| 介休市| 云浮市| 昭平县| 高阳县| 措美县| 高雄县| 璧山县| 德格县| 南漳县| 长春市| 北票市| 二手房| 海晏县| 绵竹市| 山西省| 甘肃省| 攀枝花市| 盐边县| 缙云县| 巫溪县| 新平| 临洮县| 乌拉特中旗| 南充市| 西峡县| 朝阳区| 双城市| 揭东县| 星座| 永州市| 洪江市| 和龙市|