iServer Cache Topic |
SuperMap iServer supports multiple caching methods and provides caching support for services at different levels. Browser-side caching is supported at the browser level, and Web request caching is provided at the service level. In addition, caching support is also provided at the service components level and the provider level. The details are as follows.
Browser-side cache: Browser-side cache is to cache the response content of the service (such as image, js, css and other static resource cache) in the memory of the browser, and directly return the stored cache content when receiving the same request again.
Web request cache: Cache the response results of the service in memory (ehcache), and return the cached results directly when the same request is received. Web For a detailed description of the request, refer to Configure Enable Web Request Caching . The services that support Web request caching are map services and 3D service.
Component level cache: Provides cache support for services at the component level. The cache type includes file cache, database cache, and memory cache. The services supporting component layer cache include map services and data services. The component layer cache types supported by each service are as follows:
Component layer cache type supported by each service
Cache types supported by map services | Cache types supported by data services | |
File cache |
SMTiles, GDPmap tiles (obsolete), UTFGrid property tiles (obsolete) |
- |
Database cache |
MongoDBmap tiles、MongoDB(MVT)vector tiles |
- |
Memory cache |
- |
ehcache |
Provider layer cache: The provider layer provides cache support for the service. The cache type includes file cache and database cache. The services that support the provider layer cache include map services, 3D services, and image services. The provider layer cache types supported by each service are as follows:
Provider layer cache type supported by each service
Cache types supported by map services | Cache types supported by 3D services | Cache types supported by image services | |
File type cache |
UGCV5 |
Vector,Image,Terrain,Model,Map,Scene Cache |
UGCV5 (original and compact) |
Database type cache |
- |
- |
MongoDB |
The role of the cache is reflected in two aspects, one is to speed up the service through the cache file, and the other is to publish the cache directly as a data source.
Accelerating services through caching refers to pre storing service data, images, response results, etc. in a specific way, so that the server does not need to regenerate them when receiving the same request in the future, thereby improving data access efficiency. For example, if a map service generates a map cache file in advance, the server no longer needs to regenerate images when browsing the map, but directly returns cached tiles, effectively reducing computation and improving the mapping efficiency of the map service.
Some cached data, such as map tiles, can also be published directly as a data source, and the map cache published map name service can also improve access efficiency. The map cache release process is as follows:
Publish file cache (take publishing UGCV5 cache as an example): Start iServer, enter the homepage, click "Publish Service", select datasource as "UGCV5 Tiles", enter the config file, select the service type to publish, and click "Publish" to complete the publish process of the UGCV5 cache.
Publish the database cache (take publishing the MongoDB cache as an example): Start iServer, enter the homepage, click "Publish Service", and select "MongoDB Tiles" ". Fill in the service address, database, user name, password and other information, then select the published service type, and click "Publish" to complete the publishing process of MongoDB cache.
Browser-side caching, Web request caching, component-layer caching, and provider-layer caching are applicable to different scenarios:
The browser cache is suitable for storing static resource caches that do not change frequently, such as images, js, css, and so on.
Web request cache has the advantage of high efficiency, but also has the disadvantages of small cache storage space (because too much cache will affect the efficiency of the server) and does not support cache sharing. Therefore, Web request caching is suitable for scenarios that require high cache efficiency, but do not require cache sharing because of the small amount of data.
Component-level caching is not suitable for scenarios where data changes frequently, because frequent data changes mean that the cache needs to be regenerated frequently, which takes up resources and increases time costs. 。 In the case of infrequent data changes, the file cache and memory cache of component layer are more suitable for stand-alone environment, and the database cache is more suitable for multi-machine environment.
Provider layer caching is also not suitable for scenarios where data changes frequently, because frequent data changes mean that the cache needs to be regenerated frequently, which takes up resources and increases time costs. 。 In the case of infrequent data changes, the file cache of the provider layer is more suitable for single-machine environment, and the database cache is more suitable for multi-machine environment.
Browser-side caching is generally enabled by default and does not need to be set separately.
The way to enable the Web request cache is to start the iServer, enter the Service > Advanced-> HTTP Cache page, and set enable HTTP cache.
Component layer file cache activation method (to enable SMTiles as an example)
Start iServer and go to Service-& > Service Management, opens the service details page of the service. Check "Enable Map Tile Caches" in the cache item, select the cache type as SMTiles, and then save the current configuration.
Component layer database cache activation method (take enabling MongoDB as an example)
Start iServer and go to Service-& > Service Management, opens the service details page of the service. Check "Enable Map Tile Caches" in the cache item, select the cache type as MongoDB, and click "import storage location". "Import Storage Location", enter the storage ID, service address, database, user name, password and other information, and then save the current configuration.
Component level memory caching (ehcache) is enabled by default and does not require separate configuration.
The map services file-based cache activation method (using UGCV5 as an example):
Start iServer and go to Service-&> Service Management, opens the service details page of map services. Check "Enable Map Tile Caches" in the cache item, select the cache type as UGC, select the cache version as 5.0, and then save the current configuration.
3D service file-based cache activation method:
Copy the cut 3D cache file to 【SuperMap IServer installation directory】\webapps\iserver\output\{scene}, the 3D cache can be used when accessing the 3D service.
The image services file-based cache activation method: Refer to Configuring the image services dynamic cache scheme .
The image services database-type cache activation method: Refer to Configuring the image services dynamic cache scheme .
There are two modes of caching, dynamic generation and pre-caching. Browser-side cache and Web request cache only support dynamic cache, while component-level cache (except memory cache) and provider-level cache support both dynamic cache and pre-cache. For the component and provider layer cache, when the pre-cache exists, the pre-cached file is used first, and when the pre-cache does not exist, the cache is generated dynamically.
When the service is accessed, the browser-side cache is dynamically generated and stored in the browser memory, and when the same request is received, the cache result is directly returned. After the browser-side cache expires, the cache is regenerated when the request is received again.
When the service is accessed, the service response result cache is dynamically generated in the ehcache, and when the same request is received, the cache result is directly returned. After the Web request cache expires, the cache is regenerated when the request is received again.
The production mode of component layer cache is shown in the following table:
Service Type | The cache type supported by various services | Cache production mode | ||
Dynamically generated | Pre-cache | |||
Map Services | File cache | SMTiles map tiles, GDPmap tiles (obsolete), UTFGrid property tiles (obsolete) | Generate a cache dynamically when plotting through map services | Generated by iServer Distributed Graph Cutting Service |
Database cache | MongoDBmap tiles | Generated by iServer distributed cutting service or iDesktop cutting function | ||
MongoDB(MVT)vector tiles | - | |||
Data Services | Memory cache | ehcache | Generate cache dynamically when data services are accessed | - |
The component-layer cache of map services supports two cache generation methods: dynamic generation and pre-caching. Dynamic caching is the dynamic generation of a cache while accessing a service. The pre-cache is to generate the cache in advance. When accessing the service, the generated cache file can be used directly, and the cache will not be generated dynamically.
Dynamic cache
After the map cache is enabled, a cache file will be automatically and dynamically generated in the corresponding cache storage path during map services plotting. The cache can be started by starting iServer and entering Services-&>service management, opens the service details page of the service. Check "Enable Map/Vector/Attribute Tile Cache" in the cache item, select cache type as the cache type supported by map services in the above table, and enter other relevant parameters, and then save the current configuration.
Pre-cache
Generate pre-cache through iServer Distributed Graph Cutting Service: Please refer to Create a Tilling Task .
Generate map pre-cache through iDesktop cutting function: iDesktop provides two map cache generation methods: "single-task cutting" and "multi-task cutting". For the specific steps of generating cache, please refer to iDesktop help documentation Single-task cutting and multi-task cutting.
Note: The grid tiles generated by the iDesktop graph cutting function can be used as the pre-cache of iServermap services, but the vector tiles generated by the iDesktop graph cutting function cannot be used as the pre-cache of iServermap services
After enabling the component layer cache, data services stores the dynamically generated cache in ehcache when accessing data services.
The amount of data in map services is usually large, so it is generally recommended that you update the cache through the pre-cache feature. You can update the cache through the iServer Distributed Graph Cutting Service or the iDesktop Graph Cutting feature in the same way that you generate the cache. When updating, you can choose to update the whole or part of it. Take the iServer distributed graph cutting service as an example to introduce:
Overall update : When updating through the distributed graph cutting service, set the update range to the full range of the original cache, and set the scale level to all scale levels of the original cache.
Partial update : When updating the cache through the distributed map cutting service, set the cache range to the partial area you expect to update in the "advanced setting", or set only the partial scale of the original map cache to be updated in the "cache scale". Of course, you can also do both settings at the same time, that is, only update the cache file of the partial scale level of the partial sub-region.
The lifetime of the data component layer memory cache is one minute. If the same request is not received within one minute, the cache is automatically invalidated. After the existing cache is invalidated, the cache is regenerated when a request is received.
Service Type | Cache Type | Generation Mode | ||
Dynamic cache | Pre-cache | |||
Map Services | File type cache | UGCV5 | Generate a cache dynamically when plotting through map services | Generated by iServer distributed cutting service or iDesktop cutting function |
3D Service | File type cache | Vector, Image, Terrain, Model, Map, Scene Cache | - | Generated by the iDesktop Generate Scene Cache feature |
Image Services | File type cache | UGCV5 (original and compact) | Generate a cache dynamically when plotting through image services | Silent slice generation with iServerimage services |
Database type cache | MongoDB |
Map Services
Dynamic cache
After the map cache is enabled, a cache file will be automatically and dynamically generated in the corresponding cache storage path during map services plotting. The cache can be started by starting iServer and entering Services-& >Service Management, opens the service details page of the service. Check "Enable Map Tile Caches" in the cache item, select cache type as UGC, then select cache version, and set other relevant parameters to save the current configuration.
Pre-cache
Generate pre-cache through iServer Distributed Graph Cutting Service: Please refer to Creating Tilling Task.
Generate map pre-cache through iDesktop cutting function: iDesktop provides two map cache generation methods: "single-task cutting" and "multi-task cutting". For the specific steps of generating cache, please refer to iDesktophelp documentation Single-task cutting and multi-task cutting.
3D Service
The provider layer does not support the dynamic generation of cache for 3D services, and only supports pre-caching. The pre-caching method is as follows:
Generate image cache, terrain cache, vector cache, 2D/3D map cache or 3D scene cache through the iDesktop "Generate Scene Cache" function. Please refer to the specific steps. Build Scenario Cache in iDesktop Help. Note that if you want to accelerate 3D services through pre cached files, you need to copy the pre cached 3D cache files to the 【SuperMap iServer installation directory】\webapps\isurver\output\{scene} directory after generating the pre cache.
Image Services
Dynamic cache: After enabling the image services dynamic cache, the cache will be dynamically generated under the corresponding storage location when browsing the image services. Please refer to Configuration of the Image Services Dynamic Cache Scheme for the way to start the cache.
Pre-caching (silent slicing): image services supports the silent slicing strategy. The silent slicing strategy is to use the idle resources of the server to start the image map slicing in the background. The output location of the slicing result is consistent with the dynamic cache directory. Please refer to Configuration of the Image Services Dynamic Cache Scheme for the method of starting the silent slice.
The data volume of map services, 3D services, and image services is usually large, so it is generally recommended that you update the cache through the pre-cache function in the same way as you generate the cache. When updating the cache through the pre-cache function, you can also update the whole or part of the cache according to your needs.
iServer provides caching support for map services, data services, 3D services, and image services. The caching methods supported by these services are shown in the following table:
Table Cache modes supported by iServerdata services, map services and 3D services
Data Services | Map Services | 3D Service | Image Services | |
Support the enabled cache mode | Browser-side caching, component-layer caching | Browser-side caching, Web request caching, component-layer caching, provider-layer caching | Browser-side caching, Web request caching, provider-layer caching | Browser-side cache, provider-layer cache |
In a stand-alone environment, the map services can turn on Web request caching.
In addition, if the data update frequency is low , it is recommended to open the map cache at the same time. The specific recommendations are as follows:
If the data source is workspace, it is recommended to enable UGCV5 map cache.
If the data source is SuperMap REST service, online map services, ArcGIS, For REST map services and OGCmap services, it is recommended to enable the SMTiles map cache.
When map caching is enabled, you can choose to use dynamic caching or pre-caching. When the amount of data is very large, it is recommended that you use the pre-cache method, which can effectively improve the efficiency of plotting.
The multi-machine environment includes a cluster environment and a database-based multi-node service configuration information automatic synchronization environment. In a multi-machine environment, the map services can turn on Web request caching.
In addition, SuperMap workspace, SuperMap rest map service, OGCmap services, online map services, ArcGIS, REST map services published map name service. If the data change frequency is low , it is recommended to enable the MongoDB map cache at the same time.
For data services, iServer enables component-level memory caching and browser-side caching by default. You do not need to make a selection or perform additional startup configuration.
Web request caching can be turned on for 3D service.
In addition, for the 3D service published by SuperMapworkspace, if the frequency of data source change is low, it is recommended to enable 3D pre-caching.
For image services, it is recommended to use UGCV5 cache in stand-alone environment and MongoDB cache in multi-machine environment.