修订版清理 revision-cleanup
简介 introduction
存储库的每次更新都会创建一个内容修订版本。 因此,每次更新后,存储库的大小都会增大。 必须清理旧修订版本以释放磁盘资源 — 这对于避免不受控制的存储库增长非常重要。 此维护功能称为修订版清理。 自Adobe Experience Manager (AEM) 6.0起,此功能已作为离线例程提供。
在AEM 6.3及更高版本中,引入了此功能的在线版本,称为“在线修订清理”。 与必须关闭AEM实例的脱机修订清理相比,在AEM实例处于联机状态时,可以运行联机修订清理。 默认情况下,“联机修订清理”处于打开状态,建议使用此方式执行修订清理。
注意: 观看视频,了解如何使用联机修订清理。
修订清理过程包括三个阶段:估计、压缩和清理。 估算根据可能收集到的垃圾量来确定是否运行下一阶段(压缩)。 在压缩阶段,区段和tar文件被重写,而没有任何未使用的内容。 然后,清理阶段将删除旧区段,包括这些区段可能包含的任何垃圾。 离线模式通常可以回收更多空间,因为在线模式必须考虑AEM的工作集,该工作集保留着不可收集的额外区段。
有关修订版清理的更多详细信息,请参阅以下链接:
此外,您还可以阅读Oak官方文档。
何时使用联机修订版清理,而不是脱机修订版清理? when-to-use-online-revision-cleanup-as-opposed-to-offline-revision-cleanup
建议使用“联机修订清理”来执行修订清理。 Offline Revision cleanup should be used only on an exceptional basis - for example, before migrating to the new storage format or if you are requested by Adobe Customer Care to do so.
如何运行联机修订清理 how-to-run-online-revision-cleanup
Online Revision Cleanup is configured by default to automatically run once a day on both AEM Author and Publish instances. All you need to do is define the maintenance window during a period with the least user activity. You can configure the Online Revision Cleanup task as follows:
-
In the main AEM window, go to Tools - Operations - Dashboard - Maintenance or point your browser to:
https://serveraddress:serverport/libs/granite/operations/content/maintenance.html
-
Hover over Daily Maintenance Window and click the Settings icon.
-
Enter the desired values (recurrence, start time, end time) and click Save.
Alternatively, if you want to run the revision cleanup task manually, you can:
-
Go to Tools - Operations - Dashboard - Maintenance or browse directly to
https://serveraddress:serverport/libs/granite/operations/content/maintenance.html -
Click the Daily Maintenance Window.
-
Hover over the Revision Cleanup icon.
-
单击运行。
Running Online Revision Cleanup After Offline Revision Cleanup running-online-revision-cleanup-after-offline-revision-cleanup
The revision cleanup process reclaims old revisions by generations. This means that each time you run revision cleanup a new generation is created and kept on the disk. There is a difference however between the two types of revision cleanup: offline revision cleanup keeps one generation while online revision cleanup keeps two generations. So, when you run online revision cleanup after offline revision cleanup the following happens:
- After the first online revision cleanup run, the repository size doubles. This happens because there are now two generations that are kept on disk.
- During the subsequent runs, the repository will temporarily grow while the new generation is created and then stabilize back to the size it had after the first run, as the online revision cleanup process reclaims the previous generation.
Also, keep in mind that depending on the type and number of commits, each generation can vary in size compared to the previous one, so the final size can vary from one run to the other.
Due to this fact, it is recommended to size the disk at least two or three times larger than the initially estimated repository size.
Full And Tail Compaction Modes full-and-tail-compaction-modes
AEM 6.5 introduces two new modes for the compaction phase of the Online Revision Cleanup process:
- 完全压缩模式重写整个存储库中的所有区段和tar文件。 因此,后续清理阶段可以清除整个存储库中的最大垃圾量。 由于完全压缩会影响整个存储库,因此它需要大量系统资源和时间才能完成。 完全压缩对应于AEM 6.3中的压缩阶段。
- 尾部压缩模式仅重写存储库中最近的区段和tar文件。 最新的区段和tar文件是自上次运行完全或尾部压缩以来添加的区段。 因此,随后的清理阶段只能清除存储库最近部分中包含的垃圾。 由于尾部压缩仅影响存储库的一部分,因此它比完全压缩需要更少的系统资源和完成时间。
这些压实方式构成了效率与资源消耗之间的权衡:尾压实效果较差,对系统正常运行的影响也较小。 相比之下,完全压实更有效,但对系统正常运行的影响更大。
AEM 6.5还在压缩期间引入了更高效的内容重复数据删除机制,从而进一步减少存储库在磁盘上的占用空间。
下面的两张图表展示了内部实验室测试的结果,这些结果说明了与AEM 6.3相比,AEM 6.5减少了平均执行时间以及磁盘上的平均占用空间:
如何配置完全压缩和尾压缩 how-to-configure-full-and-tail-compaction
默认配置在工作日运行尾压缩,在星期日运行完全压缩。 可以使用RevisionCleanupTask 维护任务的新配置值full.gc.days更改默认配置。
在配置full.gc.days值时,在值中定义的天数内运行完全压缩,在值中未定义的天数内运行尾压缩。 例如,如果将完全压缩配置为在星期日运行,则尾压缩从星期一到星期六运行。 例如,如果将完全压缩配置为一周的每天运行,则尾部压缩根本不会运行。
此外,请考虑:
- 尾压缩的效果较差,对正常系统操作的影响较小。 因此,它打算在工作日运行。
- 完全压缩更有效,但对正常系统操作的影响也更大。 因此打算在工作日使用。
- 尾部压缩和完全压缩都应安排在非高峰时段运行。
疑难解答 troubleshooting
使用新的压缩模式时,请牢记以下事项:
- 您可以监视输入/输出(I/O)活动,例如:I/O操作、CPU等待IO、提交队列大小。 这有助于确定系统是否正在进行I/O绑定并需要升级。
RevisionCleanupTaskHealthCheck指示联机修订清理的整体运行状况状态。 它的工作方式与AEM 6.3中的相同,并且不区分完全压缩和尾压缩。- 日志消息包含有关压缩模式的相关信息。 例如,当“联机修订清理”启动时,相应的日志消息将指示压缩模式。 此外,在某些角落情况下,当计划运行尾压缩时,系统恢复为完全压缩,并且日志消息指示此更改。 以下日志示例指示压缩模式以及从尾到完全压缩的更改:
TarMK GC: running tail compaction
TarMK GC: no base state available, running full compaction instead
已知限制 known-limitations
有时候,在尾部模式和完全压实模式之间切换会延迟清理过程。 更准确地说,存储库在完全压缩(其大小翻了一番)后将会增长。 当存储库低于完全压缩前的大小时,在后续的尾压缩中回收额外的空间。 还应避免执行并行维护任务。
建议磁盘大小至少比最初估计的存储库大小大两到三倍。
联机修订清理常见问题解答 online-revision-cleanup-frequently-asked-questions
AEM 6.5升级注意事项 aem-upgrade-considerations
迁移到Oak Segment Tar migrating-to-oak-segment-tar
Running Online Revision Cleanup running-online-revision-cleanup
Monitoring Online Revision Cleanup monitoring-online-revision-cleanup
联机修订版清理疑难解答 troubleshooting-online-revision-cleanup
Troubleshooting Based On Error Messages troubleshooting-based-on-error-messages
The error.log is verbose if there are incidents during the online revision cleanup process. The following matrix aims to explain the most common messages and to provide possible solutions:
如何运行脱机修订版清理 how-to-run-offline-revision-cleanup
Adobe提供了一个名为 Oak-run 的工具来执行修订清理。 可在以下位置下载它:
https://repo1.maven.org/maven2/org/apache/jackrabbit/oak-run/
该工具是一个可运行的jar,可以手动运行以压缩存储库。 此过程称为脱机修订版清理,因为必须关闭存储库才能正确运行该工具。 请确保根据您的维护时段计划清理。
有关如何提高清除过程性能的提示,请参阅提高脱机修订清除的性能。
-
始终确保您有AEM实例的最新备份。
关闭AEM。
-
(可选)使用该工具查找旧检查点:
code language-xml java -jar oak-run.jar checkpoints install-folder/crx-quickstart/repository/segmentstore -
(可选)然后,删除未引用的检查点:
code language-xml java -jar oak-run.jar checkpoints install-folder/crx-quickstart/repository/segmentstore rm-unreferenced -
运行压缩并等待其完成:
code language-xml java -jar -Dsun.arch.data.model=32 oak-run.jar compact install-folder/crx-quickstart/repository/segmentstore
提高脱机修订清理的性能 increasing-the-performance-of-offline-revision-cleanup
oak-run工具引入了多种功能,旨在提高修订清理过程的性能,并尽可能减少维护窗口。
该列表包括几个命令行参数,如下所述:
-
-mmap. 您可以将此参数设置为true或false。 如果设置为true,则使用内存映射访问。 如果设置为false,则使用文件访问权限。 如果未指定,则在64位系统上使用内存映射访问,在32位系统上使用文件访问。 在Windows上,始终强制定期访问文件,并且此选项被忽略。 此参数已替换 — Dtar.memoryMapped参数。
-
-Dupdate.limit。 定义将临时事务刷新到磁盘的阈值。 默认值为 10000。
-
— 压缩间隔。 在压缩当前映射之前要保留的压缩映射条目数。 默认值为1000000。 如果有足够的栈内存可用,则应该将此值增加到更高的数值,以便提高吞吐量。 此参数已在Oak版本1.6中删除,没有任何效果。
-
-Dcompaction-progress-log。 记录的压缩节点数。 默认值为150000,这意味着在操作期间记录前150000个压缩节点。 将此参数和下面记录的下一个参数一起使用。
-
-Dtar.PersistCompactionMap. 将此参数设置为true可使用磁盘空间而不是栈内存来保持压缩映射持久性。 需要Oak-run工具 版本1.4 及更高版本。 有关详细信息,请参阅脱机修订清理常见问题部分中的问题3。 此参数已在Oak版本1.6中删除,没有任何效果。
-
— 强制 强制压缩并忽略不匹配的区段存储版本。
--force参数可将区段存储升级到最新版本,此版本与旧版Oak不兼容。 此外,请考虑一下,降级是不可能的。 通常,您应该谨慎使用这些参数,并且仅在您了解如何使用它们时才使用。正在使用的参数示例:
java -Dupdate.limit=10000 -Dcompaction-progress-log=150000 -Dlogback.configurationFile=logback.xml -Xmx8g -jar oak-run-*.jar checkpoints <repository>
触发修订清理的其他方法 additional-methods-of-triggering-revision-cleanup
除了上述方法之外,您还可以使用JMX控制台触发修订清除机制,如下所示:
- 转到http://localhost:4502/system/console/jmx打开JMX控制台
- 单击RevisionGarbageCollection MBean。
- 在下一个窗口中,单击startRevisionGC(),然后单击 Invoke 以启动修订垃圾收集作业。