This topic provides details on the processes of cache generation for raster tiles generated using map image layers and imagery layers in ArcGIS Enterprise and ArcGIS Pro.
Publishing cached map and image service in ArcGIS Pro
To get started with caching, you must first publish a map or image service using ArcGIS Proor using service definitions in ArcGIS Server Manager. You can configure your service to use caching at the time of publishing or creation of a service definition file in ArcGIS Pro. See Service publishing in ArcGIS Pro and Configure a map image layer for more information.
You can create the tiles immediately upon publishing the service (suggested for smaller caches) or build a cache yourself after publishing (suggested for caches where you want to geographically limit the amount of cache built at larger scales). To build the cache yourself, use the Manage Map Server Cache Tiles (Server) geoprocessing tool available in Server Tools.
Generate Map Server Cache Tiling Scheme tool
The Generate Map Server Cache Tiling Scheme tool allows you to create a tiling scheme for your GIS content with the scale, coordinate system, and other properties of your cache, without needing to publish it as a service. The tool outputs a tiling scheme file in XML format that you can use to load the stored properties when creating caches.
Create Map Server Cache Scheme tool
The Create Map Server Cache Scheme tool allows you to convert a dynamic map or image service to a cached map or image service by creating a tiling scheme and preparatory folders in the designated ArcGIS cache directory. Only publishers and administrators can run this tool.
This tool does not create cache tiles for the service. To render the service using cache tiles, the service publisher or administrator must run the Manage Map Server Cache Tiles tool in the Recreate All Tiles mode.
Cache storage format
Raster caches are stored using the compact v2 format, where 16,384 tiles are stored in bundle files. The individual tile size can be defined in the cache tiling scheme defined using the Generate Map Server Cache Tiling Scheme or Create Map Server Cache Scheme geoprocessing tools.
While a cache is being created, you may see temporary .lock and .done files in the cache files. The .lock files allow ArcGIS Server to keep track of which bundles are in the process are being created. The presence of a .lock file does not mean that the bundle is inaccessible clients. Similarly, the .done files allow ArcGIS Server to keep track of which bundles have been created. All .lock and .done files will go away once the caching job has finished.
You can have a small cache with one bundle at each level. However, it is more common that there is a bundle boundary crossing a portion of the geography, resulting in multiple bundles in a level. Larger caches encompass many bundles.
Bundle boundaries are determined by the tiling scheme origin and are not adjustable. For instance, at the neighborhood/street level scale of 1:4096, a full bundle covers approximately the area of a mid-size county in the eastern United States.
When you update tiles, the entire bundle is not recreated. Instead, an area of 4096 by 4096 pixels (without antialiasing) or 2048 by 2048 (with antialiasing) is updated. This unit of area is sometimes referred to as a supertile.
ArcGIS clients, including the web APIs, can read the bundle files produced by the compact cache format. Web clients issue calls to the ArcGIS Server site for the specific level, row, and column of the tile. ArcGIS Server receives the request and returns the appropriate tile from the bundle.
The compact cache format has two versions: compact, introduced at 10.0, and compactv2, introduced at 10.3. The compact version includes a separate .bundlex file that serves as an index, while the compactv2 version incorporates the index into the .bundle file. Compactv2 improves performance, particularly when a cache is located on a network share or cloud store, and is only compatible with ArcGIS Server sites running on version 10.3 or later and is the default for these versions.
If you are transferring a compact cache in the compactv2 format to a site running ArcGIS Server 10.0 - 10.2, use the Export Map Server Cache tool in ArcGIS Pro.
By default, ArcGIS Server creates map and image service caches in the server cache directory that was created when you configured your ArcGIS Server site. However, you can configure a different location to store the cache files.
When you configure cache directories for a site, publishers choose one of the following directories to store the cache for their map and image services.
- Shared directory—To configure a shared directory for map and image caches, see the Server directories and Add a server directory in Server Manager topics.
- Cloud storage location—To configure a cloud store for caching, see the Cloud data stores as cache directories and Register your data with ArcGIS Server using Server Manager topics.
You can open the server cache directory to examine the cache tiles and the tiling scheme file conf.xml. A cache directory can also contain a file geodatabase status.gdb that contains information about which tiles have been built.
Cache generation on a multiple machine server site
When an ArcGIS Server site contains multiple machines that try to write tiles into a shared cached directory at the same time, scalability degrades. To prevent this, ArcGIS Server uses a local cache directory to temporarily write tiles on each ArcGIS Server machine.
When a map or image service is published to a hosting server, the cache directory of the hosting server site is used.
The following sections will address common questions regarding the behavior of map labels when the server creates map cache tiles.
Avoid duplicate labels in the cache
During a caching job, ArcGIS draws large areas at a time to help reduce duplicate labels. These large areas (supertiles) are then divided into smaller, individual tiles. A supertile is 2048 by 2048 pixels with antialiasing or 4096 by 4096 pixels without.
You should not see any label duplicates within the supertile, but duplicates can occur at the supertile boundaries. This is because when a supertile is labeled, the label placement engine is not aware of labels on adjacent supertiles. In fact, your labeling engine may be making an effort to include as many labels as possible within a supertile, thereby placing some labels near the edge. It may do the same thing on the adjacent supertile, causing duplicates near the supertile boundaries.
The only way to avoid duplicate labels in a cache is to use annotation. Annotation is a special layer in which each label is treated as a feature with attributes. The attributes include an assigned place on the map for each label. You can edit an annotation layer to remove duplicate labels.
Creating annotation layers for map caches
Annotation layers can get very large, and creating annotation for all the various scales of your map may seem like a daunting task. Two tools in the Annotation toolset, found under Cartography Tools, are designed to help you make annotation for map caches.
The first is Map Server Cache Tiling Scheme To Polygons. This tool reads a map cache tiling scheme and creates grids representing supertile boundaries at each scale of the tiling scheme. These grids help break up the annotation creation job into manageable pieces.
The next tool is Tiled Labels To Annotation. You provide the supertile grids you created, a map document, and an output workspace, and this tool creates annotation for every scale in your cache. Annotation is created for all layers in the map document that have labeling enabled.
The annotation produced by this tool gives you the same label placement you would get if creating a cache. You can then examine or query the layer for duplicate labels and delete them before you build the cache. Alternatively, you can manually clean up the annotation layer between cache updates as conflicts are noticed.
Before running the above tools on a large area, it's best to practice with a simple map using a small extent. Creating supertile grids and drawing annotation are time-intensive tasks, and you'll want to make sure you've supplied the correct parameters when you use the tools with a large map. Your practice session will also help you estimate how much time the tools may take and how much annotation they'll create.
How labeling affects tile creation speed
Computing the best locations for map labels can be a time-consuming process, and labeling can slow down your tile creation. Annotation is the fastest way to draw labels when caching because it requires no label placement decisions. Each label has predetermined coordinates that are an attribute of the label.
Using Maplex Label Engine is the slowest way to draw labels. Although Maplex offers good labeling, it can slow down map caching.
To achieve the best balance between good label placement and performance, use Maplex Label Engine to draw labels in your map document, and convert those labels to annotation and use the annotation in your map service.
Maplex can use a lot of memory. Before you use Maplex to build an entire cache, build a test cache and examine your system's memory usage while the tiles are being created. If memory usage is approaching your machine's limit, consider disabling Maplex. Failure to do so can lead to instability and possible crashes when creating tiles.
Determine whether to maintain labels in a separate cache
Vector features and their associated labels are usually included in the same cache. It's rare that you'll have a compelling reason to allow users to turn off the labels; however, isolating the labels from the features in separate caches is a good option if you need to do this.
Typically labels should not be included in caches of imagery. This allows the imagery to be used on its own or reused in other applications. Multiple imagery caches with different label sets burned into the tiles take up cumulatively more space on disk than one imagery cache with multiple label overlay caches.