Resolving AEM publish overload from unbounded QueryBuilder queries and Lucene index sorting
This article describes how to address publish tier overload in Adobe Experience Manager (AEM) caused by unbounded QueryBuilder queries that sort on properties not configured for ordered sorting in a custom Lucene index.
Description description
Publish tier overload occurs in AEM when a custom QueryBuilder query retrieves a large, unbounded result set and sorts on a property that isn’t configured for ordered sorting in the relevant Lucene index. In this scenario, the AEM repository must load all matching results into memory and perform an in-memory sort, which leads to high JVM garbage collection pressure, AdaptiveRateLimitFilter rejections, and publish pod unavailability under concurrent load.
Environment
- Adobe Experience Manager as a Cloud Service (AEMaaCS)
- All supported versions
Symptoms
- High-severity publish overloads
- Increased JVM garbage collection (GC) activity
AdaptiveRateLimitFilterrejections- Readiness and liveness probe failures on publish pods
Cause
The overload is caused by an unbounded QueryBuilder query that sorts on a property not indexed with ordered="true" in a custom Lucene index. This prevents the sort from being handled efficiently by the index, resulting in expensive in-memory operations.
Resolution resolution
Follow the steps below to resolve the issue:
-
Update the custom Lucene index definition:
-
Locate the index definition for the property being used for sorting in your custom Lucene index.
-
Add or set
ordered="true"for the property definition in the index configuration. -
Save your changes, and trigger a reindex so the update takes effect.
-
-
Bound the QueryBuilder query (if necessary):
-
If your query matches a large portion of the repository, update your custom model or service to use a reasonable default limit instead of -1 (unbounded).
-
If your filters are sufficiently narrow and only match the required content, you may keep limit = -1 after the index fix.
-
-
Optimize query performance (optional):
- Set
p.guessTotal=falseon the QueryBuilder query to skip total count calculation, and reduce overhead.
- Set
-
Review and enable caching:
- Ensure appropriate Dispatcher and/or CDN caching is enabled for the affected page to reduce publish load.
-
Verification:
- After making these changes, monitor the publish tier for stability, and confirm that overload symptoms no longer occur during peak traffic.