SuperMap iServer Temporary Resource Storage Selection and Configuration

SuperMap iServer Temporary Resource Storage Selection and Configuration

Preface

The management of the temporary resource lifecycle of SuperMap iServer adopts the following strategies:

a. Extend the lifecycle as much as possible while ensuring controllable utilization of server memory, hard disk space, and other resources, or choose to store temporary resources in MongoDB.

b. In addition, during the lifecycle, temporary resources stored locally will be cleared after restarting the service.

This mainly introduces how to configure temporary resource storage in the configuration file

  1. Setting Entrance



  1. Repository Setting

SuperMap iServer supports storing temporary resources in local files, databases, and setting survival time thresholds. Please refer to the storage and lifecycle of temporary resources for details on setting temporary file storage in the configuration file. For supported temporary resources, please refer to the list of temporary resources. Here I will introduce you to how to set up temporary resource storage configuration in the iServer global settings page.

Supported storage types: [Required] Supported storage types include Encache, Redis, MongoDB, HSQLDB, Caffeine, and PostgreSQL.

Maximum disk space: [Required when selecting Encache storage type] The default maximum disk space is 10GB, and you can adjust it according to the actual situation.

Maximum Memory: The maximum memory set when selecting the Encache storage type, which defaults to 100 MB.

Maximum number of cached objects: [Required when selecting Caffeine] The default maximum number of cached objects is 1000, and you can adjust it according to the actual situation.

Disk storage path: The storage path of the disk, which defaults to java.io.tmpdir\tmpResources and points to the [SuperMap iServer installation directory]\temp\tmpResources.

Server address: [Required when selecting Redis, PostgreSQL, MongoDB, or HSQLDB that is not on the local machine] The service address of the database, such as' 192.168.17.217:27017 '.

User Name: The user name of the database owner.

Password: The password of the database owner.

Database name: [Required when selecting MongoDB and should be an existing database] The database name used to store temporary resources.

Temporary resource expiration time (hours): The expiration time of temporary resources, in hours.

Expiration time after access (hours): If no access (read or write) is set after a certain period of time, the stored data will be destroyed, and the expiration time unit is hours.

Number of Caches: The maximum supported number of caches to store in PostgreSQL. If not set, the default value of 100 will be used. When the maximum number of caches is reached, the cache records with the least recent usage will be deleted.

  1. Storage and lifecycle of temporary resources

The management of temporary resource lifecycle adopts the following strategies:

Extend the lifecycle as much as possible while ensuring controllable utilization of server memory, hard disk space, and other resources, or choose to store temporary resources in MongoDB.

In addition, during the lifecycle, temporary resources stored locally will be cleared after restarting the service.

This mainly introduces how to configure temporary resource storage in the configuration file

3.1. Use local storage for temporary resources

You can set the use of local storage temporary resources, including memory space threshold maxBytesOnHeap and disk space threshold maxBytesLocalDisk, in the system configuration file [SuperMap iServer installation directory]\webapps\iserver\WEB-INF\iserver-system.xml. Among them, maxBytesOnHeap defaults to 100M, and maxBytesLocalDisk defaults to 10G. You can set the required space size according to your needs. It also supports adding parameters and setting the storage path for temporary resources on the disk. The default storage path is [SuperMapiServer Java installation directory]\temp\tmpResources. The algorithm used to clean up temporary resources can be set by adding parameters. In addition. For more parameter settings, please search for EhcacheRepoSetting in the help document

(1) Memory space threshold

Due to the fact that temporary resources stored in memory can ensure efficient access, but occupying too much memory space can also affect the efficiency of server operation, it is necessary to set a relatively reasonable memory space threshold. When the memory occupied by temporary resources exceeds this threshold, the server will default to using the LRU algorithm (Least Recently Used) to process temporary resources, that is, to delete the cache of the least recently used temporary resources. The algorithm for deleting temporary resources defaults to the LRU algorithm, which can be set through parameters.

(2) Hard Disk L2 Cache Threshold

Due to the limited temporary resources stored in memory, to ensure their lifespan, iServer supports saving temporary resources on the hard drive. If the resources requested by the client are not accessible in memory, the system will search for them on the hard drive. When these temporary resource caches occupy too much space, it may also affect the operation of the server, so it is also necessary to set a disk space threshold for saving temporary resources. When the disk space occupied by temporary resources exceeds this threshold, cache cleaning will be performed. When cleaning the cache, the LRU algorithm is also used.

3.2. Use MongoDB to store temporary resources

Due to the limited storage space for local temporary resources, the survival time will also be limited. SuperMap iServer supports the use of MongoDB to store temporary resources, which can effectively extend the survival time of temporary resources. In addition, MongoDB can also be used for temporary resource storage in multi-process mode, allowing resources to be shared among processes.

The method to configure MongoDB to store temporary resources is to open "MongoDB based temporary resource storage configuration" in the system configuration file and annotate the local storage configuration. As follows:

<repository class="com.supermap.services.rest.repository.MongoDBObjSerializeRepoProvider" name="mongoRepository">

<config class="com.supermap.services.rest.repository.MongoDBRepoSetting">

<host>localhost</host>

<port>27017</port>

<dbName>SuperMap</dbName>

</config>

</repository>

Enter the service address of the MongoDB you are using in the host parameter, the port number in the port parameter, and the database name in the dbName (an existing database name needs to be entered here). If the MongoDB used has security control enabled, add the username and password of the database by adding and parameters.

3.3 Using Redis to store temporary resources

SuperMap iServer supports storing temporary resources in Redis, as well as using them for temporary resource storage in multi-process mode, allowing resources to be shared among processes. The method to configure Redis temporary resource storage is to open "Redis based temporary resource storage configuration" in the iserver-system.xml file and annotate other types of temporary resource storage configurations.

Redis based temporary resource storage configuration:

<repository class="com.supermap.services.rest.repository.RedisRepoProvider">

<config class="com.supermap.services.rest.repository.RedisRepoSetting">

<type>Redis</type>

<host>192.168.17.116</host>

<port>6379</port>

<username>SuperMap</username>

<password>SuperMap</password>

</config>

</repository>

<host>: [Required] Redis service address.

<port>: [Required] Redis port number, defaults to 6379.

<username>: The username of the database owner.

<password>: The password of the database owner.

3.4 Using HSQLDB to store temporary resources

In multi-process mode, when there is no temporary resource storage configuration in the iServer system configuration file, or the temporary resource storage configuration set (such as local storage) does not support use in multi-process mode, HSQLDB is used by default to store temporary resources. In single process mode, you can also configure the use of HSQLDB storage to allow multiple iServers on the same machine to share temporary resources.

The method to configure HSQLDB to store temporary resources is to open "HSQLDB based temporary resource storage configuration" in the system configuration file and annotate the local storage configuration and MongoDB storage configuration. As follows:

Temporary Resource Storage Configuration Based on HSQLDB

<repository class="com.supermap.services.rest.repository.HsqldbRepoProvider" name="localRepository">

<config class="com.supermap.services.rest.repository.HsqldbRepoSetting">

<port>10070</port>

<startServer>true</startServer>

</config>

</repository>

Fill in and set the HSQLDB storage port number in the parameters, which defaults to 10070. The parameter indicates whether to start HSQLDB. When multiple iServers are started in a machine, simply set this parameter in one of the iServers and set the value to true.

Attention:

If multiple temporary resource storage methods are set in the configuration file, the first one in the file is used by default.

3.5 Use Caffeine to store temporary resources

iServer supports storing temporary resources in Caffeine, which is a type of memory cache. The method to configure Caffeine temporary resource storage is to open "Caffeine based temporary resource storage configuration" in the iserver system. xml file and annotate other types of temporary resource storage configurations. After completing the above configuration, start iServer and the Caffeine cache will be available.

<repository class="com.supermap.services.rest.repository.CaffeineRepoProvider" name="localRepository">

<repository class="com.supermap.services.rest.repository.CaffeineRepoProvider" name="localRepository">

<maximumSize>1000</maximumSize>

<expireAfterAccess>3.0</expireAfterAccess>

</config>

</repository>

3.6 Using PostgreSQL to store temporary resources

iServer supports storing temporary resources in PostgreSQL, which is an in memory cache. The method to configure PostgreSQL temporary resource storage is to open "PostgreSQL based temporary resource storage configuration" in the iserver-system.xml file and annotate other types of temporary resource storage configurations. After the above configuration is completed, the PostgreSQL cache will be available without the need to start iServer.

<repository class="com.supermap.services.rest.repository.PostgresRepoProvider">

<config class="com.supermap.services.rest.repository.PostgresRepoSetting">

<type>Postgres</type>

<host>192.168.17.222</host>

<port>5423</port>

<username>username</username>

<password>yubokLIRWThaAAhkOXBtiw..</password>

<dbName>dbName</dbName>

<cacheSize>21</cacheSize>

<expireTime>3</expireTime>

<deleteTimeSpan>2</deleteTimeSpan>

</config>

</repository>

  1. Supplement

1. Set survival time threshold

The cache of temporary resources, regardless of whether it exists in memory space or hard disk, will be directly deleted when it exceeds a certain survival time.

In SuperMap iServer Java 6R (2012) SP1 and earlier versions, the lifecycle of temporary subresources for certain resources such as tempLayersSet, trackingLayer, and queryResults is controlled through the holdTime parameter. The client or user can set the lifetime of temporary resources to 15 minutes by default.

In SuperMap iServer Java 6R (2012) SP2 and later versions, it supports setting the interface configuration parameter defaultHoldTime in the service configuration file (iserver-services-interfaces.xml), which is used to set the default save time for temporary resources (such as tempLayersSet, trackingLayer, queryResults, etc.), which is 7 days by default. After setting, it takes effect on the survival time of all temporary resources in the REST interface. The setting method is:

<interface class="com.supermap.services.rest.RestServlet" name="rest">

<config class="com.supermap.services.rest.RestConfig">

<accessControlAllowOrigin>*</accessControlAllowOrigin>

<!-- The default save time for rest resources is in minutes -->

<defaultHoldTime>10080</defaultHoldTime>

</config>

</interface>

<interface class="com.supermap.services.rest.JaxrsServletForJersey" name="restjsr">

<config class="com.supermap.services.rest.JaxrsConfigForJersey">

<accessControlAllowOrigin>*</accessControlAllowOrigin>

<!-- The default save time for rest resources is in minutes -->

<defaultHoldTime>10080</defaultHoldTime>

</config>

</interface>


Note:?We are looking for distributors, resellers, and partners all over the world. For any inquiry, please contact us at:?[email protected].

要查看或添加评论,请登录

Evelyn Sun的更多文章

社区洞察

其他会员也浏览了