Select to view content in your preferred language

A Content Delivery Network (CDN) Approach to ArcGIS Enterprise using AWS CloudFront

6620
0
06-08-2020 07:19 AM
by Anonymous User
Not applicable
8 0 6,620

Organizations are serving a broader and more geographically disperse audience than ever before.  Organizations that have a global reach may experience latency when trying to load content across the globe.  Content Delivery Networks (CDNs) use edge servers to deliver content closer to the client application that requested it.  Instead of a client application in Europe accessing a server in Northern California, content can be delivered from edge servers in Europe.  CDN Settings allow us to control how often the edge servers return to the origin in Northern California to fetch updated content.  The benefit here is twofold, less performance hit on the origin server and less latency for the end users.   

 

ArcGIS Enterprise can take advantage of CDNs to push static files to edge locations. In this example, we use Amazon's CDN Service (CloudFront) to distribute static ArcGIS Enterprise files across the globe, allowing for quicker load times and less load on the back-end server.  This blog details: content and its corresponding context path that are candidates for edge caching, a walk-through of how to use AWS CloudFront in front of ArcGIS Enterprise, and some additional considerations when using a CDN.

 

The first user in a particular edge server region always gets a request delivered directly from the origin.  Subsequent users in that same region are then served content from the edge cache.  Requests continue to be delivered from the edge servers until the configured Time To Live (TTL) is met.  

More information on Amazon CloudFront: 

Content Delivery Network (CDN) | Low Latency, High Transfer Speeds, Video Streaming | Amazon CloudFr... 

ArcGIS Enterprise Content: 

Secure Content

ArcGIS Enterprise inherently supports secure content which requires a token to access.  This content is not a good candidate for caching, as it changes frequently and each user obtains a different token.  This will make all requests forward to the origin instead of being served from the edge cache. 

Dynamic Content

ArcGIS Enterprise servers a mix of dynamic and static content.  When adding a CDN in front of ArcGIS Enterprise it is important to understand the different type of content that should be cached.  If we cache content that is meant to be dynamic, errors may occur in your applications.  Below you can find a breakdown of the context paths and the associated content for both Portal for ArcGIS and ArcGIS Server.

Static Content:

ArcGIS Enterprise also serves a significant amount of static content, such as: CSS, JavaScript, HTML files, and images. This content changes infrequently and is generally a good candidate for edge caching.  Below you can find some examples of static content that are good candidates for an edge server and dynamic content, but that is not ideal for edge caching. 

 

Portal for ArcGIS
Static Content (context path)Dynamic Content (context path)
Portal JS Files (portal/home/10.7.1/*)Sharing API (portal/sharing/*)
Portal HTML Files (portal/*.html)Portal Admin (portal/portaladmin/*)
Portal JavaScript API (portal/jsapi/*)
Portal Image Files (portal/home/images/*)

* The above examples all use a Web Adaptor name "portal".  If you named your web adaptor something different, replace the "portal" with you web adaptor name

* The JavaScript API will have to be updated depending on what version of ArcGIS Enterprise you are using

ArcGIS Server
Static ContentDynamic Content
Tiled Services (server/rest/services/<Service Name>/MapServer/tile/*)Sharing API (server/sharing/*)
Select Queries from Map Services *

* The above examples all use a Web Adaptor name "server".  If you named your web adaptor something different, replace the "server" with you web adaptor name

Using CloudFront as your CDN with ArcGIS Enterprise:

There are three steps to deploying your ArcGIS Enterprise with CloudFront.  The first step is creating the distribution and specifying what the default behavior for the cache is.  This step is critical, as it allows dynamic content to pass thru the edge servers and onto the origin.  The second step is adding additional cache behaviors.  This step provides the ability to cache specific path patterns from the distribution.  The final step is to map the existing DNS Record Set to the CloudFront distribution CNAME. 

  1. Add Cache behaviors to the above created distribution
  2. Create a CloudFront Distribution:
    1. From your AWS Console navigate to the CloudFront service under the "Networking & Content Delivery" section.
    2. Select "Create Distribution" to enter the CloudFront deployment wizard. 
    3. Select "Get Started" under the Web at the "Select a Delivery Method" page.
    4. Populate the Origin Settings with the following information: (Amazon Documentation on Origin Settings)

      Note: The Origin Domain Name will be the Load Balancer or Server that your ArcGIS Enterprise is accessible from.  In this example we use the an Application Load Balancer but other properties are supported here as well.  CloudFront will forward requests to this location when populating it's edge cache.  

      Note:

      Ensure the default behavior of Cache Based on Selected Request Headers is set to None to support portal's Dynamic Content.


      Note:  Ensure Object Caching is set to Use Origin Cache Headers.  Portal will send a response header with Cache-Control: no-cache by default.  CloudFront has the ability to override this.   Additional cache behaviors will be added in the next steps to overwrite this and allow static content to be cached.  Note: Ensure you add your DNS to the "Alternate Domain Names".  This comes into play when you map your DNS Records Set to the CloudFront Domain Name.
  3. Find your distribution ID from the CloudFront homepage
  4. Navigate to the "Behaviors" tab
  5. Select "Create Behavior"
  6. Populate the behavior with the following

    Note:  The path pattern determines what paths to apply this behavior.  This option allows us to cache content. 
    Note: Unlike the initial deployment ensure you chose the "Customize" option for "Object Caching".  This allows you to specify a default, minimum, and maximum amount of time (in seconds) your object will live in its edge location. You can see mine are set to 86400 (1 day).
  7. Repeat this step for the following "Path Patterns"Note: The path patterns are related to the table in the "ArcGIS Enterprise Content" Section above.  You will notice the path pattern for a tiled map service there as well. 
    Note: After an upgrade the path pattern for "portal/home/10.6.1" will have to be updated for the specific version of ArcGIS Enterprise you are using.

      3. Point your DNS records to the CloudFront CNAME


Considerations

  • These steps come after you have completed the installation and configuration of your ArcGIS Enterprise deployment
  •  Ensure that the CloudFront cache is invalidated after an upgrade
  • Please review the pricing model for Amazon’s CloudFront CDN: https://aws.amazon.com/cloudfront/pricing/