ArcGIS Blog

Data Management

ArcGIS Enterprise

Use response caching in ArcGIS Enterprise

By Gary MacDougall and Diana Muresan

Response caching is a backend server mechanism that stores the results of a query so that when the same query is made again, the server can quickly provide the stored answer instead of processing the request again. This significantly increases the performance and scalability, as the server doesn’t have to process the same request repeatedly using additional resources. It can respond much quicker by reusing the stored responses. This is ideal for read-only data or data that changes infrequently.

For example, if a map application that stores read-only or infrequently changing web feature layers – such as park or roads data – requests the same features to display, response caching ensures these features are quickly retrieved from the cache, making the map load faster for users.

Response caching diagram
Response caching diagram

With ArcGIS Enterprise, you will need version 11.0 or later to enable response caching on your hosted feature services. Currently it is not supported with feature services that are referencing a registered data store.

Note: For ArcGIS Online, this capability is automatically enabled on all hosted feature services.

This workflow example demonstrates enabling response caching on a hosted feature service layer. The hosted feature services were already published to ArcGIS Enterprise.

Dallas Parcels - hosted feature layer
Dallas Parcels - hosted feature layer

The hosted feature service contains two layers: parcels and HOA boundaries in Dallas, Texas.

Parcels layer
Parcels layer

The Parcels feature layer is often queried by multiple departments within the organization to retrieve parcel and owner information. To improve the web app performance, response caching will be enabled on this layer.

System requirements

To use response caching, your deployment must be running ArcGIS Enterprise 11.1 or later. Additionally, the hosting server must have the object store registered. This storage type plays a key role in supporting hosted scene layers, hosted 3D tiles layers, cached query responses, and other more. 

To verify whether your hosting server has the object store configured: 

  1. Sign in to ArcGIS Server Manager for the hosting server as an administrator.  
  2. Navigate to Site > Data Stores. 
  3. Look for an entry labeled Managed Object under the Type column. 

 

ArcGIS Server Manager can be used to verify ArcGIS Enterprise has the object store registered
ArcGIS Server Manager can be used to verify ArcGIS Enterprise has the object store registered

If you see this entry, your deployment has the object store. If not, check out the ArcGIS Enterprise: Migrate to the object store blog article to learn more. 

Once you’ve confirmed your system meets the requirements, you’re ready to enable response caching on the Parcels web feature layer.  

Enabling response caching

The updateDefinition operation allows you to update a definition property in a feature service layer. In this example, you will enable response caching on individual hosted feature services layer. This granular level allows you to control which layers will write response cache content to the object store.

1.To use the updateDefinition operation, access the layer admin resource using the following URL format:
https://gisdev1.esri.com/server/rest/admin/services/Hosted/Dallas_Parcels/FeatureServer/1/updateDefinition

The UpdateDefinition operation
The UpdateDefinition operation

2. In the Input box, set the layer cache to true and add an expiration date to define the number of days a cache will be stored before it is removed.
In this example, the response cache is set to expire after one day.

Enable layer cache
Enable layer cache

Once a cache is removed, a new response cache is created the next time the service is queried. The updateDefinition operation can be used to change or remove the expiration. An expiration value of 0 means the cache will never expire. The value for the expiration property must be an integer.

3. Click updateDefinition.
A JSON response confirms the operation was successful.

Operation response
Operation response

Once the operation is successful, you can confirm the change on the layer’s JSON page by checking for the “supportsQueryWithCacheHint” layer property.

Refresh the Parcels JSON layer page, and using the search shortcut, type supportsQueryWithCachHint.

Under advancedQueryCapabilities, you will see the supportsQueryWithCachHint property set to true. This indicates that layer queries support the cacheHint parameter and it has been enabled for response caching.

The supportsQueryWithCacheHint property
The supportsQueryWithCacheHint property

You can also disable response caching on an individual hosted feature service layer, using the same updateDefinition operation. But this time, set the enabled property to false.

Disable response caching
Disable response caching

This disables the response caching and sets the supportsQuerywithCachHint property back to false.

You can now use response caching in your workflows to improve performance and scalability on your hosted web feature layers in ArcGIS Enterprise.

For more content on feature services, check out the Geodatabase Resource Hub.

Share this article