Using and building clusters |
Cluster means to register one or more SuperMap iServer services into cluster server to provide a single view of service for customers When requests arrive at cluster server, the cluster server will uniformly dispatch which iServer to handle what requests by using cluster tethnology, while users don't need to know this process. Using cluster can highly improve the concurrency and performance of iServer.
In iServer, the Distributed Map Tiling module is a typical application of cluster technology.
There are two ways to configure cluser, one is through iServer WebManager as shown in this section, the other is through configuration file, see: Managing clusters through configuration file.
The cluster system includes the following contents:
Fig.1 Cluster Overview
For a specific machine:
After a member join in the cluster, it will send a report to ClusterServer every 2 seconds; after ClusterServer receives the report, then it will consider this member is an available child node and the child node will be put into the "cluster members list". When the client or GIS server sends a request to ClusterServer (parent node), the parent node will assign tasks to its members based on the load balancing principle, as shown in the figure below. The member makes response to the request and then return the response result to ClusterServer; then the ClusterServer will return the response result to the client which just sends the request, or the GIS server. For example, when the client browses the map, the received map slices may come from distinct cluster members, not just from the cluster server which the client requests. For the following situations, the cluster server will determine the cluster member is timeout, and will not assign tasks to the member or send the assigned task to the other node.
In which, both the connection timeout settings and the response timeout settings can be set via the configuration file, see Managing the cluster with the configuration file.
For more information, please refer to Cluster System Communication Mechanism.
Fig. 2 Cluster communication mechanism
The GIS server is the service-side which directly provides services to the client. Using cluster can improve the performance and load to provide client services directly to customers end GIS services can improve performance by using clustering and load volumes of the GIS services. The cluster system will use the local GIS server as an outlet to provide high-performance services to the client.
GIS server has two ways of using cluster:
Fig. 3-1 Use local cluster service |
Fig. 3-2 Use other cluster service |
The operation method that GIS server uses the cluster is:
Visit the Use Cluster page: http://gisserver:8090/iserver/manager/clusterusage, check the "Enable the cluster" check box, select "Use local cluster service" or "Use other cluster service" as shown in figure 3-1 and 3-2. If you select "Use other cluster service", then you need to add "Cluster service URL" and "Token".
Only when you select "Use Cluster", the GIS server can give response to the request from the client so as to improve the performance of the GIS service.
Fig. 4 User Cluster
About the implementation of the cluster filter, please refer to implementing the cluster filter.
Multiple GIS servers can improve their capability by building the cluster. By default, the GIS server of SuperMap iServer enables the cluster service function, which can accept the child node at any time. As shown in figure 3-1, the "ID 2" directly joins in the cluster service of "ID 1", then a simple cluster was built up. Note that the "ID 1" supports multiple GIS servers to join the it and it can join the other cluster (then the multilayer cluster was established).application_cluster.png
The cluster parent node as ID1, i.e., ClusterServer, is mainly used to monitor and coordinate the child nodes, which can control the security for the whole cluster system, check the members and decide whether the members can join in the cluster. The parent node can enable service security to control its members.
If the parent node enables the service security:
Visit http://clusterserver:8090/iserver/manager/clusterMembers, click "Enable" to set the security Token, and then click the "Allow" button to permit that the member joins in the cluster or click the "Inhibit" button to inhibit that the member joins in the cluster system.
Fig.5 Configure cluster
Click "Check service list of cluster main node" on the "Configure Cluster" page to get the service instance list in the current cluster system and each service instance can be provided by which child nodes.
You can check the cluster members list on the "Configure Cluster" page, including "Ordinary members" and "Controlled members" referring to the Controlled Cluster.
For ordinary members, click "Check services" to check the service instances provided by the current child nodes. If the security control is enabled, then you need to click "Allow" to permit the child node joins in the cluster.
To improve the cluser system's forwarding efficiency, iServer adopts asynchronous way to handle requests by default. If you need to further enhance the efficiency by customized configuration, you should modify <clusterRequestClientSetting> of <clustering> in the iserver-system.xml of master node manually.
For the detailed information, see: Configuration of cluster forward parameter in Managing clusters through configuration file .
The server as shown by ID2 is the cluster child node, which can join the cluster by:
Visit http://clusterchild:8090/iserver/manager/clusterReporter, click "Add reporter", input "Cluster address" and "Security token", check the "Enable reporter" check box, and then click "OK" to finish registering the GIS server into the parent node. For single-machine multi-process cluster, registering the child node into the parent node is free from any security restrictions.
Fig. 6. Join a cluster
Reporter is used to report the GIS service provided by the cluster child node as shown by ID2 to the cluster server as shown by ID1. The "cluster service address" is the reporter address of the cluster parent node, for example, the cluster service address of clusterservice1 is http://clusterservice1:8090/iserver/services/cluster, i.e., the reporter address of clusterservice1, which supports adding multiple reporters, then the local GIS service can be used by multiple cluster servers.
SuperMap iServer supports child nodes to join the cluster in a controlled manner, which is applicable to the case of the free child node. The child node does not need to provide services but can receive the control of the parent node. Once the child node opens the controlled cluster, it is subject to the full control of the parent node, and its own existing service instances and iServer WebManager are disabled while the service instances and data of the parent node will be synchronized to the child node. In which, the service instance corresponding to the service component cluster and the spatial processing will be filtered to the child node.
The child node as the cluster member in the controlled mode, is only be used to process the request forwarded by the parent node.
As shown in the figure above, both the controlled child node (ID2) and non-controlled child node (ID3) can exist simultaneously in a cluster system. The configuration method that the child node joins the cluster in the controlled way is as follows:
<controllable>
<address>http://clusterservice:8090/iserver/services/cluster</address>
<enabled>true</enabled>
<token>-71 90 -24 -17 -115 80 -56 -17</token>
</controllable>
After the child node opens the controlled cluster, the parent node will automatically synchronize services and data to the child node, so the parent node can forward the request of the client to the child node for processing.
If the GIS server included in the cluster doesn't use SuperMap Object Java in SuperMap iServer product package, use the independent SuperMap iObject Java. When using the map service to output the image, the image dislocation will appear. To solve this problem, you should perform the following setting: open the file SuperMap iObjects Java 6RBinSupermap.xml, and set CustomMapRatioEnable as true (<CustomMapRatioEnable>true</CustomMapRatioEnable>).
SuperMap iServer is deployed in the Servlet container in the form of Servlet. If the SuperMap iServer, which is a child node of the cluster, is moved to another Servlet container with a different port, you need to manually change the port under <host> node in the service.xml file to a new one. In addition, you can access any GIS service on the child node to automatically set a new port.
The ZIP product package of SuperMap iServer in the windows platform, for example, when configure the cluster in the two packages, it is need to ensure that the Tomcats in different product packages use different ports. The method of modifying the Tomcat port in the ZIP is to modify the related ports in the %SuperMap iServer_HOME%/conf/server.xml, such as <Server port="8016"……>, <Connector port="8091"…… redirectPort="8454" ……>.
The configuration of single cluster has the following two methods:
The ZIP product package of SuperMap iServer in the windows platform, for example, when configure the cluster in the two packages, it is need to ensure that the Tomcats in different product packages use different ports. The method of modifying the Tomcat port in the ZIP is to modify the related ports in the %SuperMap iServer_HOME%/conf/server.xml, such as <Server port="8016" ……>, <Connector port="8091" ……redirectPort="8454" ……>.
If ensure that the ports of multiple product packages is different, you can separately startup services. Then use the Configure cluster page to build up a cluster system.
This method can be used in the configuration of single cluster in other middleware.
In Tomcat, SuperMap iServer supports the starting the specified configuration directory. Therefore, if you set the different configuration file, you can configure the single cluster by using the single iServer product package.
The specific methods are as follows:
Prepare the configuration file
The configuration directory of SuperMap iServer contains all the configuration information in the SuperMap iServer. In the un-war package, the default configuration directory locates in the %SuperMap iServer_HOME%/webapps/iserver/WEB-INF (not includes lib). In the war package, the default configuration directory locates in the %iserver service directory %/WEB-INF (not includes lib). For example, copy the WEB-INF configuration directory in product package directly (not includes lib), and rename, and save as "D:\WEB-INF1".
The server.xml, %SuperMap iServer_HOME%/conf/server.xml of Tomcat contains the port setting that starts iServer service. Different configuration file should be modified to different ports. For example, copy the server.xml file in the product package directly, and modify the port and save as server1.xml.
Start a service
In Tomcat, you can simultaneously custom the server.xml in Tomcat and the configure file in SuperMap iServer by using the following order in windows:
Start the service:
set JAVA_OPTS=%JAVA_OPTS% -Diserver.config="D:/WEB-INF1"
startup.bat -config="D:/server1.xml"
Stop the service:
shutdown.bat -config="D:/server1.xml"