在大型 Oak 存储库中运行脱机 Tar 压缩缓慢,并导致 OutOfMemoryException。无法跟踪进度。有时,脱机压缩完成后存储库大小会增加。

环境

Adobe Experience Manager 6.x

Oak 1.2.x 和 1.4.x

解决方案

使用以下命令:

sudo -u crx nohup /usr/java/latest/bin/java -Dtar.memoryMapped=true -Doak.compaction.eagerFlush=true -server -Xmx30g -Dcompaction-progress-log=5000000
-Dlogback.configurationFile=logback-compaction.xml -Dcompress-interval=150000000 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/path/to/dumps
-jar oak-run-1.2.16-R1750358.jar compact /path/to/segmentstore >> oak-tar-compact-a0.log 2>>oak-tar-error-a0.log

注意:上文中有几个参数需要调整其路径。

oak-run 版本 1.2.17 for AEM6.11.4.4 for AEM6.2 或更高版本中包含一些新参数:

  • -Dlogback.configurationFile=logback-compaction.xml - 此参数记录压缩进度。您必须将 logback-compaction.xml 文件添加到与 oak-run jar.相同的位置。

logback-compaction.xml:

<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="true">
 
  <appender name="STDERR" class="ch.qos.logback.core.FileAppender">
    <file>/mnt/dumps/compaction.log</file>
    <encoder>
      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>
 
  <logger name="org.apache.jackrabbit.oak.plugins.segment.Compactor" level="DEBUG"/>
 
  <root level="warn">
    <appender-ref ref="STDERR" />
  </root>
</configuration>
  • -Doak.compaction.eagerFlush=true - 这是一个新标志,可使压缩程序能够使用持久化事务功能。它可以防止内存不足异常。

跟踪进度:

compaction.log:

18:18:34.531 [main] WARN  o.a.j.o.p.segment.file.TarReader - Could not find a valid tar index in [/mnt/crx/author/crx-quickstart/repository/segmentstore/data01624a.tar], recovering...
18:18:36.569 [main] DEBUG o.a.j.oak.plugins.segment.Compactor - Eager flush enabled.
18:19:36.910 [main] DEBUG o.a.j.oak.plugins.segment.Compactor - Compacted 5000000 nodes, 1987504 properties, 57 binaries in 60328 ms.
18:22:06.905 [main] DEBUG o.a.j.oak.plugins.segment.Compactor - Compacted 10000000 nodes, 4771516 properties, 294 binaries in 149994 ms.
18:23:46.708 [main] DEBUG o.a.j.oak.plugins.segment.Compactor - Compacted 15000000 nodes, 6505235 properties, 323 binaries in 99803 ms.
18:36:38.014 [main] DEBUG o.a.j.oak.plugins.segment.Compactor - Compacted 20000000 nodes, 25559366 properties, 430789 binaries in 771305 ms.
18:40:46.736 [main] DEBUG o.a.j.oak.plugins.segment.Compactor - Compacted 25000000 nodes, 62174573 properties, 442755 binaries in 248722 ms.
18:46:51.053 [main] DEBUG o.a.j.oak.plugins.segment.Compactor - Compacted 30000000 nodes, 96729247 properties, 1040072 binaries in 364317 ms.

本产品经 Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 许可  Twitter™ 与 Facebook 中的内容不在 Creative Commons 的条款约束之下。

法律声明   |   在线隐私策略