上次更新時間
2021年4月29日
在大型 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 執行版本 1.2.17 (適用於 AEM6.1) 與 1.4.4 (適用於 AEM 6.2) 或更新版本中,包含一些新參數:
- -Dlogback.configurationFile=logback-compaction.xml - 此參數會記錄壓縮進度。您必須在將 logback-compaction.xml 檔案新增至 Oak 執行 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.