发出来时候总是没有,故分两段发续上文:

(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/isWithCom/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:            8090Document 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真实请求处理并发量。