A cached map service is a regular map service that has been enhanced to serve maps very quickly using a cache of static images. The map cache is a directory that contains image tiles of a map extent at specific scale levels. Returning a tile from the cache takes the server much less time than drawing the map image on demand.
The map above has been cached at two scales. The server can now return these tiles to the client instead of rendering the map on each request.
You can create a cache from any existing map service using ArcCatalog or scriptable geoprocessing tools. Once you create the map cache, the server will be able to use the tiles and will not have to dynamically render the map again. Creating an effective cache requires some design and planning which is outlined in this section of the help.
A complete cached map service uses all of the following components to do its work:
There are two types of cached map services. A map service can be cached as either a single fused cache or a multi-layer cache. A single fused cache contains image tiles that are created by grouping all the layers together at each scale, or level of detail. Fused caches appear as group layers and don't allow turning layers on and off, selecting features, or adjusting labels. A multi-layer cache contains image tiles that are created for each layer at each level of detail. Multi-layer caches appear in a client as collections of layers with controllable visibility, labeling, and feature selection enabled.
Clients behave differently with these two cache types. Fused caches appear as group layers with feature selection disabled, label selection that cannot be adjusted, and visibility that cannot be controlled by turning sub-layers ON and OFF. Multi-layer caches appear in a client as collections of layers with controllable visibility, labeling, and feature selection enabled.
For optimal performance, use fused caches. Applications built with fused caches do not use the parent map service, but instead pull the images directly from the cache directory or by using the tile handler service.
Cache Organization: The cache directory hierarchy
The map service cache directory resides in a server cache directory that has been registered with ArcGIS Server.
The images that comprise a map service cache are organized into a directory hierarchy within the server cache directory. This hierarchy contains a top level directory that is named after the map service itself. In this directory, you’ll find a subdirectory for the particular data frame in the map being cached. Next, depending on whether you’ve created a single fused cache or a multi-layer cache, you’ll either find a single subdirectory called _alllayers or multiple subdirectories, each named after the specific layer being cached in the multi-layer cache. Within each layer subdirectory, you’ll find subdirectories for each level of detail, followed by subdirectories for each tile row, and finally the actual image files that represent a particular column in the row. The following diagram illustrates a map service cache directory hierarchy, showing the single fused cache case.
You can choose a tile size from 128, 512, or 1024 pixels and an output image format from PNG8, PNG24, PNG32 or JPEG. If no background color is set in the map document the background color will default to 253,253,253. This behavior can be changed in ArcMap.
Cache Description: The cache configuration file
A complete description of the cache, including its organization and a mapping between the spatial reference of the source map document and the tiling grid, is provided in a cache tiling scheme file called "conf.xml" located at the top of the directory hierarchy. The tiling grid uses a level of detail, row, column referencing scheme. For example, a tile named C00000000.png in the R00000000 row directory of the L00 level of detail directory corresponds to a tile in the upper-left-most corner of the tiling grid at the smallest scale level. This upper-left-most corner is mapped to a tile origin specified in map units of the source mxd. The tiling scheme file also defines the levels of detail at which the cache has tiles, the size of the tiles in pixels and the screen resolution (DPI) for which the tiles are intended to be most commonly displayed.
The web server references the map service, a cache directory and a tile handler. More information about the map service is available in the topic Map services. The cache directory is a virtual directory that exposes the map service cache. Retrieving tiles from a virtual directory is the fastest way to render maps in clients, so most ArcGIS web and desktop clients will first attempt to get their tiles from this virtual directory. If that fails due to network outages or permission restrictions on the virtual directory, ArcGIS clients will next try to use the tile handler. This is another web service that accepts tile requests, then uses the operating system to retrieve tiles directly from the cache directory before returning them over the web to the client.
The ArcGIS Server hosts map services that can initially retrieve the tiling scheme configuration and, under certain circumstances, blend and down-sample tiles from the cache. As a final backup, a map service will render the map dynamically in the event that the cache is unavailable.
Cached map servics can also fulfill query and data requests from clients. For example, a user might perform an Identify operation on the map. Even though the user is clicking on one of the static map tiles, the map service has the ability to determine the location of the click and return the information.
Using a cached map service is not automatically the best option for serving mapping needs. For instance, if your data changes frequently, a cache would be impractical because it would need to be updated often.
Using a cached map service can dramatically improve the time clients take to display complex base-maps. A client using a cached map service is usually only limited by the bandwidth of its connection when retrieving and displaying maps. For example, a simple 2D map that takes four seconds to request, render and display using a dynamic map service can be improved to support hill-shading and other advanced graphics properties and be served and displayed in about one second using a cached map service. Using cached map services thus eliminates the need to trade quality for performance.
If you can cache your map, then there is no need to trade quality for performance.
Cached map services use far fewer server resources than dynamic map services. After an initial connection to the server to discover the scheme and structure of the cache, most clients never communicate with the server again while retrieving tiles. Relieved of the necessity to generate dynamic images, ArcGIS Server is free to handle other requests to the map service, such as individual feature queries or data analysis.
Cached map services are most appropriate for use with complicated base map imagery, or maps with many layers containing data that does not change very often.
This document is the first in a series about map caches. See these topics for additional information: