Skip To Content

Cache efficiently

Generating and storing caches for map and image service caches can be resource intensive on your server. Below are common strategies you can use to cache more efficiently.

Estimate cache size

Determining the cache size for your tiling scheme will allow you to allocate the appropriate amount of resources for cache generation. The larger the cache size, the more CPU, memory, time, and disk space will be used when generating cache content.

The ArcGIS Pro Sharing pane allows you to estimate the size of a cache based on a caching configuration. You can use this estimate to understand the variations in cache size that will result from choosing different image formats or scale levels.

See Configure a web tile layer for more information.

Caching detailed levels using an area of interest

By default, cache content is created for the full extent of a map. If you are creating tiles for a large geographic entity that is not rectangular, you can conserve time and resources by interactively defining an area of interest to cache.

Areas of interest are the regions and features that will be most commonly viewed by your users. For instance, major cities, landmarks, and highways are common areas of interest users will frequently zoom to. These areas can be adjacent or spread out and separated by areas that users are less likely to zoom to, such as deserts or oceans.

Caching by area of interest or feature class allows you to create and maintain tiles only in the places where you need them, avoiding empty or uninteresting areas. By doing so, you are requesting that the server tools only create tiles that cover those areas of interest. The rest of the areas can be cached on demand when requested by clients. This can save you time and disk space that would be consumed by creating unnecessary tiles in areas that are not visited by users.

Areas of interest can be single or multi-part and can be regularly or irregularly shaped.

There are two places you can specify the feature class:

  • When you publish a service or first initialize a cache, set the Area of interest to cache parameter on the Caching > Advanced Settings tab of the Service Editor. From the drop-down list, choose Import from a feature class. This area of interest only applies if you have chosen to build the cache automatically when publishing.
  • Open the Manage Map Server Cache Tiles tool and set the Area Of Interest parameter. This setting overrides any area of interest that you may have set in the Service Editor.
Note:

If you're running the Manage Map Server Cache Tiles tool in ArcGIS Pro, you can also sketch an area of interest on the screen. This is helpful for one-time runs of the tool in which you are trying to patch missing tiles in a known area of the cache or ensure coverage in a given area. However, for most structured caching jobs or updates, it's recommended that you supply a feature class.

The image below shows a theoretical grid of tiles that would be created if the feature class contained just the state of California. The feature class helps you avoid creating unneeded tiles in the ocean and in neighboring states. These unneeded tiles would have been included if the default rectangular extent were used.

Illustration of tile creation based on feature boundaries

If you want to build or update a cache based on a point or polyline feature class, you must first buffer the features by a small amount to get a polygon feature class. It's also recommended that you dissolve and generalize the buffers before using them as your area of interest.

At world and country scales, you create relatively few tiles, so it doesn't make much difference whether you cache by feature class.

Avoid projection on the fly

It is recommended that you project your source data into the same coordinate system as your map and tiling scheme to avoid projection on the fly.

If you choose not to change the projection of your working database, it is recommended that you prepare a one-way replica of your production database that will only exist to create the cache and satisfy user queries.

Optimize labeling

Labeling is the process of automatically generating and placing descriptive text for features in maps and scenes. A label is a piece of text on map that is dynamically placed and is derived from one or more feature attributes. Computing the best locations for map labels can be a time-consuming process that can slow down your tile creation.

By default, a standard label engine is used to make decisions about where to place each label. The duration of this process increases as more labels are generated.

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.

Annotation layers

Annotation layers provide a way to avoid duplicate labels in a cache. Annotation is a special layer in which each label is treated as a feature with attributes. The attributes include an assigned location on the map for each label. You can edit an annotation layer to remove duplicate labels.

Annotation is the fastest way to draw labels when caching as it requires no label placement decisions. Each annotation has predetermined coordinates that are an attribute of the label. See Annotation for more information.

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.

Maplex labels

Maplex offers more options, is more computationally advanced, and places more labels than the standard labeling engine. While Maplex provides good results, it also consumes a significant amount of memory and can slow down map caching.

Caution:

Before using Maplex to build a full cache, it is recommended that you build a test cache and examine your system's memory usage while the tiles are being created. If in this process your memory usage is approaching your machine's limit, consider disabling Maplex. If you choose not to disable Maplex, you may experience system instability and possible crashes when creating tiles.

To achieve the best balance between good label placement and performance, it is recommended that you use Maplex labeling engine to draw labels in your map document and convert those labels to annotation and use the annotations in your map service.

Maintaining labels in a separate cache

Vector features and their associated labels are usually included in the same cache. It is rare that you will want to allow users to turn off labels; however, isolating labels in a separate cache from features is available if it is necessary.

Typically labels should not be included in caches of imagery. By keeping them separate, imagery can be used on its own or reused in other applications. Multiple imagery caches with different label sets burned into the tiles will cumulatively take up more space on disk than one imagery cache with multiple label overlay caches.

Optimize symbology, fonts, and antialiasing

In some instances, you may choose to add custom text symbols or fonts to your map content. See Text symbols for more information.

To use fonts in a web layer, the fonts must either reside on the machine participating in the server site or, if the font is not present on the server, must be able to be embedded within the GIS resources. To confirm if a font can be embedded, view the properties of the font in Microsoft Windows.

Note:

Type 1 fonts will not be able to be embedded for use in web layers. Type 1 fonts can either be installed on the server or swapped with TrueType or OpenType fonts. The absence of fonts on the server machines can cause unnecessary lookups for font substitution to determine symbology and slow down the performance of cache generation. To ensure the cache generation process picks up the newly installed fonts, restart all machines participating in the server site.

Antialiasing is the process of smoothing the edges of lines and labels to prevent a pixilated appearance. Text antialiasing has little impact on performance; however, feature antialiasing is a much more computationally demanding process that can slow caching.

Applying some level of feature antialiasing can improve the appearance of your vector maps. However, it is important to consider that each increase in antialiasing quality can significantly extend the time it takes to create a cache. The Fastest or Fast settings are suitable for most caches. It is recommended that you avoid higher quality settings unless your test caches have shown the higher level of quality is necessary.

Monitor system resources while caching

For the fastest tile creation, your CPU should be working near, but not at, 100 percent during the tile creation process. As each map is different, achieving this level of CPU usage may require some trial and error with your cache settings. See Caching tools and server resources for caching for more information.

Your system's memory is the other factor that governs the performance of cache generation. The memory resources on the server machines participating in the cache generation process should be at 60 percent. The intensity of cache generation on memory usage depends on the symbology, the labeling, and the number of features and rasters in your map or image services. If memory usage approaches your machine's limit, random crashes will occur and your server may become unresponsive.

Network bandwidth to the source data and the arcgiscache directory is another metric you should monitor. The caching process makes thousands of requests to read source data. Having a sufficient read bandwidth to the source data of the map document being cached will ensure faster cache creation.

During cache creation, each caching instance writes bundles to the cache directory defined for the map or image service. Keeping the arcgiscache directory on a file system that hosts arcgisjobs or arcgisoutput directories can cause slowdowns from exceeding the bandwidth.

For you GIS server site cache, you can designate a directory on a highly available file server that uses a Storage Area Network (SAN) or highly available Network Attached Storage (NAS). This can be configured with the help of your information technology staff to ensure faster read and write times.

Cache generation in multimachine sites

You can configure your stand-alone server, hosting server, or federated server to be a multi-machine site and use the resources of all participating machines in the server site to generate caches faster.

Local cache directory

When your ArcGIS Server site contains multiple machines, and these machines try to write tiles into a shared cache directory at the same time, scalability degrades. For this reason, the server uses a local cache directory to temporarily write tiles on each ArcGIS Server machine.

ArcGIS Server uses local cache directories by default when a cache is located on a network share or on a cloud object store. Each caching service instance writes one bundle file (collection of 16,34 tiles) to the local cache directory. When completed, the bundle is moved to the shared cache directory on the file system or cloud object store. Writing bundles locally and moving them to a shared cache directory is more scalable than having all of the machines write bundles directly to the shared cache directory.

Use local copy of a file geodatabase

The caching process requires reading the source content multiple times. Keeping the input source data on a network location may result in slowdown if several machines are accessing the source data at the same time. If those requests do not need to leave their machines your tiles will draw faster. As such, placing a copy of the source GIS datasets on your servers will result in greater speeds and stability during cache creation.

Scene service cache and local cache directories

The local cache directory is also used when building scene tile content for scene services. The scene cache is built in the local cache directory before it is moved to the tile cache data store for final cache tile storage. These temporary files can be as large as three to five times the final cache size and will be deleted when the cache finishes building.

Set the local cache directory location

The default local cache directory is the temp folder for the ArcGIS Server account. You can change this using the ArcGIS Server Administrator Directory.

It's recommended that you have at least 0.5 GB of available space in this location for each running instance of the CachingTools geoprocessing service multiplied by the number of machines in your ArcGIS Server site. More space may be required for JPEG or mixed-format caches that use a high compression quality, or detailed PNG caches with high bit depth.

As mentioned in the previous section, if you are publishing scene services, the local cache directory must have enough space available to accommodate the temporary files generated when creating scene service caches.

  1. Create a directory on each machine in the ArcGIS Server site using an identical path. Make sure the ArcGIS Server account has write access to these directories.
  2. Open a web browser to the ArcGIS Server Administrator Directory. The URL is formatted http://gisserver.domain.com:6080/arcgis/admin.
  3. If necessary, log in using a user name and password that has administrative access to ArcGIS Server.
  4. Click system > properties > update.
  5. In the text box, add a localTempFolder property pointing at your folder. For example: {"localTempFolder":"/data/temp"}
  6. Click the Update button.
  7. Use ArcGIS Server Manager or the Catalog window to navigate to the ArcGIS Server folder named System and stop and then start the following services:
    • The CachingTools geoprocessing service for map and image services
    • The SceneCachingTools geoprocessing service for scene services