Resolving 504 Gateway Timeout errors during AEM Managed Services deployments

This article explains how to resolve recurring 504 Gateway Timeout errors and performance degradation on Adobe Experience Manager (AEM) Managed Services Publish instances that occur during and after release deployments, particularly when custom sitemap generation jobs are involved.

Description description

Environment

Adobe Experience Manager (AEM) Managed Services 6.5 LTS, Production Publish instances

Symptoms

  • End users see 504 Gateway Timeout errors when loading pages during and after release deployments.
  • Automated page crawling operations slow down significantly (For example: from a baseline of 1 URL/second to around 0.1 URLs/second).
  • A substantial portion of URLs (up to 25%) return connection timeoutor 504 errors during affected periods.
  • Server unresponsiveness and degraded performance are observed, especially during deployment windows.

Cause

Continuous or high-concurrency custom sitemap generation jobs create sustained CPU and repository load, leading to resource contention and thread pool exhaustion. This results in delayed request processing and 504 Gateway Timeout errors, especially during periods of high activity, such as release deployments.

Resolution resolution

Follow the steps below to resolve the issue:

  1. Review your custom sitemap generation service or job implementation:

    • Ensure that sitemap generation jobs aren’t running continuously or with excessive concurrency.

    • Optimize filtering and processing logic to avoid inefficient operations over large collections.

    • Limit the number of parallel sitemap generation workers, if possible.

    • Schedule sitemap generation jobs to run during off-peak hours and avoid overlap with deployment windows.

    • Implement caching for generated sitemap URLs where feasible to reduce repeated repository traversal.

  2. Monitor server resources:

    • Track CPU, memory, and swap usage on Publish instances during deployments.

    • If possible, provision additional compute or memory resources temporarily during release windows to handle increased load.

  3. Follow deployment best practices:

    • Use rolling restarts or traffic draining to minimize end-user impact during deployments.

    • Consider blue-green deployment strategies to ensure availability and reduce downtime.

    • Coordinate heavy background jobs (such as sitemap generation) to avoid running concurrently with deployments.

  4. After implementing these optimizations, monitor system performance and error rates during subsequent deployments. Adjust configurations and scheduling, as needed, based on observed results.

recommendation-more-help
experience-cloud-kcs-help-kbarticles