To run garbage collection:
Option | Description |
---|---|
Run memory garbage collection first | To run the garbage collection of the main memory first (also known as heap garbage collection). This process evicts objects that are still in the main memory, but no longer referenced. The data store garbage collection only reclaims items that are no longer in the main memory. |
Delete unused items | Selecting this option means that any unused files are deleted from the Data Store. If this option is disabled, only the last modified date of the used items is updated, but no files are deleted. If multiple stand-alone repositories share a data store, or if multiple distinct clusters share a data store, don't enable this option. Instead, remove old items manually or use a script. (For example, delete files older than one week after running the data store garbage collection on each repository). A cluster is one repository; that means you can enable "Delete unused items" when using multiple cluster instances that share a repository. |
Use a persistence manager scan | When this option is enabled, the process uses a low-level persistence manager scan if the persistence manager supports this option. Selecting this option speeds up the garbage collection process, but could slow down concurrent operations. If the option is disabled, a higher-level node travels algorithm is used. |
Shared Data Store
When using a CRX cluster, Data Store garbage collection can be run from any cluster node.
Cluster Data Store
When using the cluster data store (data store configuration option ClusterDataStore), run garbage collection on all cluster nodes separately.
Multi-Repository Data Store
If multiple distinct repositories use the same data store at the same time (such as author and publish instances), don't use the Delete option. Instead, the process is as follows:
To run the garbage collection manually, use the following code:
GarbageCollector gc;
SessionImpl si = (SessionImpl)session;
gc = si.createDataStoreGarbageCollector();
// optional (if you want to implement a progress bar / output):
gc.setScanEventListener(this);
gc.scan();
gc.stopScan();
// could be a separate button, if multiple repositories use the same data store:
gc.deleteUnused();
Changes in Data Store Garbage Collection from CQ5.5 onwards(Applies to crx 2.3.15 or later)
From CQ 5.5 onwards the CRX that provides the repository is an OSGi service. The CRX is registered in the OSGi Service Registry as MBean service. This MBean is available in the JMX Console which exposes the datastore garbage collection attributes and operations.
[1] curl -u admin:admin -X POST --data delete=false -H "Referer: http://<host>:<port>/system/console/jmx/com.adobe.granite%3Atype%3DRepository" http://<host>:<port>/system/console/jmx/com.adobe.granite%3Atype%3DRepository/op/runDataStoreGarbageCollection/java.lang.Boolean
[2] curl -u admin:admin -X POST --data value=15 -H "Referer: http://<host>:<port>/system/console/jmx/com.adobe.granite%3Atype%3DRepository" http://<host>:<port>/system/console/jmx/com.adobe.granite%3Atype%3DRepository/a/DataStoreGarbageCollectionDelay
AEM 5.6.1 (CRX 2.4.30+)
The new improvised fast datastore garbage collection has been implemented in 5.6.1. Which is now enabled by default (runDataStoreGarbageCollection). To run old method of datastore garbage collection, use runDataStoreClassicGarbageCollection which runs data store garbage collection by avoiding the use of the optimized TarPM garbage collection.
Download Hotfix 3241 from package share by clicking here.
Download
Sign in to your account