Workflow
Purging:
Situations like content
syncing & migration, development issues, bulk execution or some other unpredictable
situations can lead to huge number of workflow instances to run concurrently on
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 gets accumulated and it would
be beneficial to clean them to manage disk space and performance. It`s
essential to purge instances to manage size of JCR repository. So, workflow
purging is one of the maintenance activity that must be carried out.
Workflow
Purge Scheduler
Workflow Purge Scheduler is categorized
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
into 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’s and run parallel.
·
For
adding another instance configuration, use ‘+’
sign provided on configuration.
The factory
PID of configuration is ‘com.adobe.granite.workflow.purge.Scheduler’.
PID of 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 scheduler to purge the workflows. It has 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 purge.
Workflow
Age: Enter 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 slowness of AEM server and it disk
space grows rapidly.
We can also use JMX console to purge 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 operation 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 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