Situations like content syncing & migration, development issues, bulk execution or some other unpredictable situations can lead to a huge number of workflow instances to run concurrently on the AEM environment.
Concurrent running workflow instances could lead to performance issues on the server. Completed workflow instances should be purged as nodes in the repository get accumulated and it would be beneficial to clean them to manage disk space and performance. It`s essential to purge instances to manage the size of the JCR repository. So, workflow purging is one of the maintenance activities that must be carried out.
Workflow Purge Scheduler
Workflow Purge Scheduler is categorised as ‘Sling Service Factory’ so we can create an instance configuration we can configure it on Felix Console and manage the workflow purge scheduling as per our requirements.
Workflow Purge Scheduler is categorised as ‘Sling Service Factory’ so we can create an instance configuration we can configure it on Felix Console and manage the workflow purge scheduling as per our requirements.
- Every time when we launch workflow a new workflow instance gets created (like any of the activities i.e. asset uploading, publishing, etc.).
- Once workflow completes with the stages mentioned (successful/aborted/terminated), it’s archived and never gets deleted.
- Workflow purging needs to be done to clean up archived workflow instances.
- Workflow purging can be done based on 3 categories for the workflows
- Based on Workflow model
- Based on Workflow Completion status
- On Age of the workflow instance
Enabling Workflow Purge Scheduler
- It’s not a pre-configured feature in AEM. We need to enable AEM to automatically purge workflows.
- Log in to AEM OSGi configuration console, host:port/system/console/configMgr to configure automatic workflow purging
- Search for a configuration ‘Adobe Granite Workflow Purge Configuration’ which will be managing the purge schedule of the workflow instances. As it is a Service Factory we can create multiple instances of this config for different criteria and run parallel.
- For adding another instance configuration, use the ‘+’ sign provided on the configuration.
- The factory PID of configuration is ‘com.adobe.granite.workflow.purge.Scheduler’.
- PID of the instance will be set when the configuration is saved.
- A unique ID is appended to the Factory PID of the configuration like below com.adobe.granite.workflow.purge.Scheduler-myIdentifier where myidentifier is the unique id mentioned above.
- Configure below to set up the scheduler to purge the workflows. It has the following fields:
- Job Name: Name of particular purge instance.
- Workflow Status: Options like ‘Completed’ and ‘Running’ we can choose which status of workflows to purge.
- Models to purge: It`s a multi-field to provide different models to purge. Configure ids of the models that are required for a purge.
- Workflow Age: Enter the number of days after which the workflows have to be purged.
- Provide values in inputs as required.
- Workflow instances are stored as nodes on AEM. Long-running instances where website users or automated jobs can run workflows, this adds large amounts of content to repository leading to the slowness of the AEM server and its disk space grows rapidly.
- We can also use the JMX console to purge the repository of completed workflows at below URLs.
- To manually purge workflow, execute the operation purgeCompleted on the console with domain com.adobe.granite.workflow.
- Click on maintenance for the domain mentioned above.
- Based on the type of scenarios required for workflows we can execute different operations provided in the console.
- Currently on an average took few seconds or less than a minute while purging active/completed workflows on localhost. Average time for completion of the process would differ based on content use of workflows, workflow instances it got created & currently running/completed workflows.
- Adobe in default recommends Weekly Maintenance Window for Workflow Purge task. Adobe default suggested timing for the daily maintenance window is 2 to 5 AM and to run weekly maintenance window will execute b/w 1 and 2 AM on Saturdays.
- § Workflow Purge Scheduler URL: https://host:portNo/system/console/jmx/com.adobe.granite.workflow%3Atype%3DMaintenance
Statistics of purged workflows:
https://host:portNo /system/console/jmx/com.adobe.granite.workflow%3Atype%3DStatistics
https://host:portNo /system/console/jmx/com.adobe.granite.workflow%3Atype%3DStatistics
No comments:
Post a Comment
If you have any doubts or questions, please let us know.