iServer Concurrent Request Control Mechanism |
In Web-based GIS applications, when concurrently accessing services published by large-scale GIS data (such as map rendering, data querying, or spatial analysis on tens of millions of vector data), performance bottlenecks in GIS servers often occur due to thread resource exhaustion, subsequently causing delayed responses or inaccessibility of management pages. To ensure the GIS server can function properly, it is generally recommended to improve machine resource utilization by increasing the JVM maximum heap memory and maxThreads of Tomcat. However, when machine resources are limited, these methods cannot simply resolve the issue. To address this problem, iServer provides a concurrent request control mechanism that can effectively allocate threads used in business operations to guarantee overall server access performance. This mechanism is enabled by default. To disable or adjust parameters, you can modify the iServer configuration file: [SuperMap iServer installation directory]\webapps\iserver\WEB-INF\web.xml.
The configuration of the concurrent request limit is as follows:
<filter>
<filter-name>requestLimitFilter</filter-name>
<filter-class>com.supermap.server.host.webapp.ConcurrentRequestLimitFilter</filter-class>
<async-supported>true</async-supported>
<init-param>
<param-name>enableRequestLimit</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>limitUrls</param-name>
<param-value>/iserver/services/.*/rest.*;/iserver/services/.*/wms.*;/iserver/services/.*/wfs.*;/iserver/services/.*/arcgisrest.*</param-value>
</init-param>
<init-param>
<param-name>maxConcurrentRequest</param-name>
<param-value>160</param-value>
</init-param>
<init-param>
<param-name>maxWaitTime</param-name>
<param-value>60000</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>requestLimitFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
In which,
enableRequestLimit:Whether to enable the iServer concurrent request control mechanism; defaults to true. To disable this mechanism, set it to false.
limitUrls:The URL addresses of services that require concurrent request control, expressed through regular expressions; multiple regular expressions are separated by ';'. The default value is /iserver/services/.*/rest.*;/iserver/services/.*/wms.*;/iserver/services/.*/wfs.*;/iserver/services/.*/arcgisrest.*, meaning iServer by default applies concurrent request control to services with rest, restjsr, wms, wfs, and arcgisrest interfaces.
maxConcurrentRequest:The maximum number of concurrent requests that controlled service URLs can accept, with a default value of 160. When maxThreads and maxWaitTime remain constant, setting this value lower reduces the threads available for accessing service URLs and decrease the service's performance by approximately 5%. If customization is needed, it is recommended to set this value to 80% of maxThread.
maxWaitTime:The maximum waiting time for requests awaiting execution, with a default and recommended value of 60000 milliseconds. When maxThreads and maxConcurrentRequest remain constant, setting this value lower causes requests accessing service URLs to be rejected more quickly, thereby freeing up more threads for other requests. For services published by large-scale GIS data with low-frequency access, it is recommended to configure their service URLs in limitUrls and appropriately reduce maxWaitTime.
Notice:
1. When multiple web filters exist at the same time, the loading and implementation of each web filter has a strict order relationship. It is consistent with the definition order of each web filter in the web.xml file. In order to make requestLimitFilter work, you need to define FilterMappping for the Filter in web.xml.
2. After the web.xml configuration is completed, restart the iServer to take effect.