SuperMap iServerJava 6R擴充領域開發及壓力測試—判斷點在那個面內(2)

來源:互聯網
上載者:User

發出來時候總是沒有,故分兩段發續上文:

(3)匯出為jar包,放到SuperMap iServerJava 6R安裝目錄下\webapps\iserver\WEB-INF\lib下即可。

(4)找到SuperMap iServerJava 6R安裝目錄下\webapps\iserver\WEB-INF\config\services.xml檔案,然後在相應模組添加Component及介面配置,具體可以參考SuperMap iServerJava 6R相關組態管理模組。

component配置

配置Component <component class="com.zhangwei.Extend.InWithComponent" interfaceNames="inWith" name="InWithCom" providers="ugcDataProvider-World"></component>
配置interface <interface class="com.zhangwei.Extend.ISWithInServlet" name="inWith"></interface>

2、使用apache的測試載入器ab測試url如下:擴充測試url:http://172.16.2.23:8090/iserver/services/InWithCom/inWith?in={"resultSetting":{"returnEdgeFeatures":true,"returnEdgeGeometry":true,"returnEdgeIDs":true,"returnNodeFeatures":true,"returnNodeGeometry":true,"returnNodeIDs":true,"returnPathGuides":true,"returnRoutes":true},"turnWeightField":"TurnCost","weightFieldName":"length"}測試命令:測試命令 ab -n 10000 -c 100 http://172.16.2.23:8090/iserver/services/InWithCom/inWith?in={"resultSetting":{"returnEdgeFeatures":true,"returnEdgeGeometry":true,"returnEdgeIDs":true,"returnNodeFeatures":true,"returnNodeGeometry":true,"returnNodeIDs":true,"returnPathGuides":true,"returnRoutes":true},"turnWeightField":"TurnCost","weightFieldName":"length"}測試結果:測試結果C:\Program Files\Apache Software Foundation\Apache2.2\bin>ab -n 10000 -c 100 http://172.16.2.23:8090/is
WithCom/inWith?in={"resultSetting":{"returnEdgeFeatures":true,"returnEdgeGeometry":true,"returnEdgeIDs"
Features":true,"returnNodeGeometry":true,"returnNodeIDs":true,"returnPathGuides":true,"returnRoutes":tr
eld":"TurnCost","weightFieldName":"length"}
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 172.16.2.23 (be patient)

Server Software:        Apache-Coyote/1.1
Server Hostname:        172.16.2.23
Server Port:            8090

Document Path:          /iserver/services/InWithCom/inWith?in={resultSetting:{returnEdgeFeatures:true,r
:true,returnEdgeIDs:true,returnNodeFeatures:true,returnNodeGeometry:true,returnNodeIDs:true,returnPathG
Routes:true},turnWeightField:TurnCost,weightFieldName:length}
Document Length:        15116 bytes
//並發粒度為100個,即每次發送100個請求
Concurrency Level:      100
Time taken for tests:   2.606 seconds //測試總耗時
Complete requests:      173           //完成請求數數
Failed requests:        1             //失敗的請求數
   (Connect: 0, Receive: 0, Length: 1, Exceptions: 0)
Write errors:           0
Total transferred:      2654717 bytes //傳輸資料總量
HTML transferred:       2630183 bytes //傳輸的html資料總量
Requests per second:    66.77 [#/sec] (mean)   //平均每秒處理事務數量,即請求個數。
Time per request:       1497.787 [ms] (mean)   //平均事務請求時間,即每次請求耗費時間
Time per request:       14.978 [ms] (mean, across all concurrent requests) //每個請求實際已耗用時間的平均值
Transfer rate:          1006.20 [Kbytes/sec] received   //平均每秒網路上的流量,可以協助排除是否存在網路流量過大導致回應時間延長的問題

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.5      0       2
Processing:    20  647 742.2    276    2543
Waiting:       20  647 742.2    276    2543
Total:         20  647 742.2    276    2544
//下面的內容為整個情境中所有請求的響應情況
Percentage of the requests served within a certain time (ms)
  50%    313
  66%    872
  75%   1217
  80%   1472
  90%   2119
  95%   2279
  98%    118
  99%     29
 100%    539 (longest request)

3、測試結果分析

初次接觸ab工具,分析參數大多從網上抄襲,多多見諒。從分析結果上來看每秒處理大概66個左右,請求耗費時間也挺長,但是在10000訪問,100並發情況下訪問效率尚可,有進一步最佳化空間如:

(1)component層為測試資料準備方便進行兩次查詢,查詢出點和面幾何對象,更為實際的介面應該是點傳參數傳過來,而面對象可能查詢擷取或者也直接傳過來,更好的情況是直傳參傳到後台,這樣雖然提高了傳輸資料量但是減少了查詢時間,可以調高的效率應該很高,另外使用者互動過程中可能涉及情況不同,所以直接進行傳參可能效率更高,互動性更好些,當然需要根據情況綜合考慮。

(2)參數傳遞此處直接封裝死到代碼中,可能會有效率上的損耗。

(3)可以考慮多個servlet來處理,這樣更符合tomcat容器的處理servlet的特點,但是此處未考慮,後續再加。

上面是一次針對自己封裝的介面測試,並不能代表SuperMap iServerJava 6R真實請求處理並發量。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.