At some point, you may need to transfer map caches between folders or machines. The process to do so depends on the format of your cache, the versions of ArcGIS Server to and from which you are copying the cache, and the size of the cache file or files itself.
Copy a compact cache
The compact cache storage format, available in ArcGIS Server 10.0 and later, is designed to facilitate copying of large caches. In this type of cache, tiles are not stored as individual files as in exploded caches; rather, they are grouped into .bundle files. This results in much fewer files to copy, as well as a smaller cache. Using the compact cache storage format instead of the alternative exploded storage format can significantly reduce cache copy time.
The compact cache format has two versions: compact, introduced at 10.0, and compactv2, introduced at 10.3. The earlier version includes a separate .bundlx file that serves as an index; the newer version incorporates the index into the .bundle file. This provides a performance improvement, particularly when the cache is located on a network share or a cloud store. However, the newer version of the compact cache can only be used by ArcGIS Server sites running 10.3 and later. It's the default format for caches created in these versions.
If you are copying and transferring a cache between two sites that are both at 10.3 or later, you can do so seamlessly from your machine.
If you are transferring a compact cache generated by a site running 10.3 or later — meaning it is in the compactv2 format — to a site running a version 10.0 through 10.2.2, use the Export Map Server Cache tool in ArcMap or ArcGIS Pro. This tool produces a compact cache in the earlier version (with a separate .bundlx file). You can then send the exported cache to the recipient server site. You can also use this tool to export exploded caches for use in 10.0 and earlier.
If you are transferring a compact cache to a site running ArcGIS Server 10.3 or later, you should update it to the improved compactv2 format. To do so, use the Upgrade Map Server Cache Storage Format tool in ArcMap (or its ArcPy equivalent) to do so.
Copy a large cache
Various commands can be used to copy large amounts of cached data. Along with cp -r and tar -cf, you can use the following commands to copy cache data:
- When copying a tarball archive cache, use the following command:
dd if=<source tar file> of=<destination tar file> bs =2046k
The value of the block size (bs) can be increased or decreased to accommodate the appropriate bandwidth.
- To copy large cache directories to a remote machine while tracking their progress, use the following command:
rsync -avx -progress /arcgiscache/mapservice user@remotemachine:/destination/directory
Various third-party applications are available that are designed to help copy large numbers of files. Copying with these applications may prove more stable than using the operating system tools. Some of these applications allow scheduling and queuing of jobs.
When using FTP to move exploded caches, the transfer may go more smoothly if you zip bundles of files together beforehand. You do not have to apply compression to the zipped files; the goal is just to avoid transferring an unwieldy number of small files. Several third-party applications are available that can simplify zipping and extraction.
Caches and folder structure
You can copy a cache onto a machine with an existing map service and the cache will be detected when the service restarts. The top-level cache folder must have the same name as the map service. An exception is when the map service is organized in a folder on the GIS server, in which case the top-level directory syntax is <folder name>_<map service name>.