Question / Problem
When and how to optimize the Tar PM?
Answer / Resolution
Optimizing Tar Files
As data is never overwritten in a tar file, the disk usage increases even when only updating existing data. When optimizing, the Tar Persistence Manager copies data that is still used from old tar files into new tar files, and deletes the old tar files that contain only old or redundant data.
If optimization is stopped before it is finished completely, then the next time when it is started it will continue where it left off (it doesn't start from the beginning).
If there is only one file, optimization will have no effect (no new file is created).
The disk space required to run the optimization is at most the size of one data tar file, which is 256 MB by default (for CRX 2.0; this setting can be changed using the parameter maxFileSize). This applies to both the shared directory as well as the local directory, meaning the total amount of temporary disk space used is at most 512 MB by default.
Automatic Scheduled Optimization
CRX automatically runs Tar PM optimization between 2 am and 5 am. If the automatic optimization is not finished at 5 am, then it will stop automatically. It will continue from there the next night (it doesn't start from the beginning).
To change the time when automatic optimization is run, use the Tar PM configuration option "autoOptimizeAt". Setting this value to "02:00" will trigger an optimization every day at two in the morning. In order to change the default time, edit repository/your_workspace/workspace.xml, as an example I set the optimization below to run at 1 a.m every day until 4 a.m the latest: