Friday, 7 November 2025

Understanding CDN Cache Purge in AEM as a Cloud Service


Adobe Experience Manager (AEM) as a Cloud Service uses a global Content Delivery Network (CDN) to cache content closer to users for faster performance. Sometimes, when you update or delete content, you may need to remove the outdated version from the CDN cache. This process is called purging the cache.

Why Purge the Cache?

Purge requests help ensure users always see the latest version of your content. Without purging, the CDN might continue serving stale or old data from its cache instead of fetching new content from AEM Publish.

Types of Purge

  • Single URL Purge: Removes a specific resource from cache.
  • Surrogate Key Purge: Purges multiple related resources grouped under the same key.
  • Full Purge: Clears all cached resources from the CDN.

Fast vs Soft Purge

Fast (Hard) Purge: Instantly removes cached content from all CDN nodes. Users will immediately fetch fresh content from AEM. This is best for critical updates but may cause a temporary spike in origin load.

Soft Purge: Marks cached content as stale but keeps serving it until new content is fetched from AEM. This approach reduces load on the origin and ensures a smoother user experience.

How to Issue a Purge Request

You can trigger a purge using an HTTP request with the PURGE method. Authentication is done using a purge key defined in your CDN configuration.


curl -X PURGE "https://publish-<your-environment>.adobeaemcloud.com/path/to/resource.html" \ -H "X-AEM-Purge-Key: <your_purge_key>" \ -H "X-AEM-Purge: hard"

The above command removes a single cached resource immediately (hard purge).

Surrogate Key Purge Example

If your responses include surrogate keys like:

Surrogate-Key: product-page product-images

You can purge all related resources together:

curl -X PURGE "https://publish-<env>.adobeaemcloud.com" \ -H "X-AEM-Purge-Key: <your_purge_key>" \ -H "Surrogate-Key: product-page" \ -H "X-AEM-Purge: soft"

Important Notes

  • Use purge operations carefully, especially full purges, as they can cause a sudden increase in requests to AEM Publish.
  • Store purge keys securely and rotate them periodically.
  • Test purge behavior in development or stage environments before applying to production.
  • Always ensure that updated content is available on AEM Publish before triggering a purge.

Best Practices

  • Use surrogate keys to control purging in groups instead of URLs for efficiency.
  • Prefer soft purges for non-critical updates to minimize system load.
  • Schedule purges during off-peak hours if possible.
  • Monitor CDN and origin response times after purging.

By using the CDN purge features wisely, you can maintain high performance while ensuring users always access the latest content.


 


No comments:

Post a Comment