CQ Tar Optimization




CQ Maintenance


Tar Optimization

Overview:

CQ OOTB has tar persistant manager. All data (Except datastore data) is persisted in tar file in CQ. Data writes in tar file is always append only even if it is modification or delete operation (More information about how data is stored in tar). This cause data tar to grow over time. Tar optimization is process of optimizing tar file and removing un reference data from data tar file and thus reducing space. Following are tar files in CQ which is checked during tar optimization process.

 Location     Purpose
 /crx-quickstart/repository/workspace/crx.default/data*tar Stores all CQ data not stored in datastore. For example node properties
 /crx-quickstart/repository/version/data*tar Stores Version Information. In CQ All versions are stored under /jcr:system/jcr:versionStorage/UUID
 /crx-quickstart/repository/tarJournal/data*tar Stores Cluster sync information


Repository Configuration:

Tar optimization can be configured using following configuration in /crx-quickstart/repository/repository.xml. OOTB CQ automatically run tar optimization between 2:00 AM to 5:00 AM unless it is disabled or changed. More information Here

CQ Tar Optimization Configuration

<!-- In this example data tar and Tarjournal will be optimized between 1 AM to 4 AM and version tar between 3AM to 4 AM -->

<!-- This is for data tar and tar Journal -->
 <Workspace name="${wsp.name}" ....
<PersistenceManager class="com.day.crx.persistence.tar.TarPersistenceManager">
       ....
<param name="autoOptimizeAt" value="01:00-04:00" />
</PersistenceManager>
....
<!-- This is for version Tar -->
 <Versioning rootPath="${rep.home}/version">
.......
<PersistenceManager class="com.day.crx.persistence.tar.TarPersistenceManager">
...
<param name="autoOptimizeAt" value="03:00-04:00" />
</PersistenceManager>
...... 
</Versioning>

Here is what OptimizeAt mean.

autoOptimizeAt(optional, default is 2:00-5:00) Automatically optimize at the given time. When the optimization should be run. Example: 2:00 to automatically optimize every morning at two. The index files will be merged as well if required. To disable the automatic optimization, set the value to "-0" (which actually means 'stop optimization at midnight').


Starting Tar optimization from UI:
  • Go to HOST:PORT/crx/explorer/config/index.jsp
  • Click on tar optimization 

  • From felix console select tar optimization
  • You can also stop tar optimization after staring it


Starting Tar optimization from curl command:

 

CQ Tar Optimization Using CURL

curl -u <UID>:<PASSWORD> -X POST http://<HOST>:<PORT>/system/console/jmx/com.adobe.granite:type=Repository/op/startTarOptimization/

CRX Log Message to look for

com.day.crx.persistence.tar.file.TarFile /crx-quickstart/repository/workspaces/crx.default/data_00000.tar id:0 length:75436032 append:75435008 943288331 optimize: 2420224
  


Some QA:

Q: Why I need to change tar optimization time
A: Some time you have a lot of data and 3 Hour optimization time is not enough for all tar files. Or During OOTB tar optimization time, Your server is really busy.

Q: Does my tar files size reduces after tar optimization
A: Tar file size is always set to your configuration. However overall disk size reduces. 

Q: Does my system perform slow during tar Optimization
A: Yes. There will be some overhead, thats why it is recommended to run tar optimization during non business hour. However performance impact is minimal.

Q: Can I completely disable tar optimization 
A: Yes you can. Note that in this case tar file size may grow. Some time you can disable tar optimization and run it manually during non business hour or day.

Q: What happen if assigned time for optimization is finished but tar optimization not.
A: Tar optimization stops at time it is assigned. For example is autoOptimizeAt is set to 3:00-4:00 that mean tar optimization will stop at 4:00 AM. Process can optimize whatever it can during that time.



                                                                                                                   
 
          
 
             
Comments