How do I increase max trash can deletion candidates in Artifactory during Garbage Collection?

Matthew Wang
2021-08-22 06:16

Currently, the default amount of candidates that can be un-deployed from the trash can during GC is 10000. You can configure this amount by setting the artifactory.trashcan.max.search.results in the $ARTIFACTORY_HOME/etc/artifactory.system.properties in 6.x or $JFROG_HOME/var/etc/artifactory/artifactory.system.properties in 7.x.

You can enable the below GC debug logging in the logback.xml (for 6.x):<appender name="GC" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${artifactory.home}/logs/gc.log</File>
<encoder>
<pattern>%date ${artifactory.contextId}[%thread] [%-5p] \(%-20c{3}:%L\) - %m%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<FileNamePattern>${artifactory.home}/logs/gc.%i.log</FileNamePattern>
<maxIndex>13</maxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>10MB</MaxFileSize>
</triggeringPolicy>
</appender>

<logger name="org.artifactory.storage.binstore.service" additivity="false">
<level value="trace"/>
<appender-ref ref="GC" />
</logger>
<logger name="org.artifactory.storage.db.binstore.service" additivity="false">
<level value="trace"/>
<appender-ref ref="GC" />
</logger>
For 7.x:<appender name="GC" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${log.dir}/artifactory-gc.log</File>
<rollingPolicy class="org.jfrog.common.logging.logback.rolling.FixedWindowWithDateRollingPolicy">
<FileNamePattern>${log.dir.archived}/artifactory-gc.%i.log.gz</FileNamePattern>
<maxIndex>10</maxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>25MB</MaxFileSize>
</triggeringPolicy>
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="org.jfrog.common.logging.logback.layout.BackTracePatternLayout">
<pattern>%date{yyyy-MM-dd'T'HH:mm:ss.SSS, UTC}Z [jfrt ] [%-5p] [%-16X{uber-trace-id}] [%-30.30(%c{3}:%L)] [%-20.20thread] - %m%n</pattern>
</layout>
</encoder>
</appender>

<logger name="org.artifactory.storage.binstore.service" additivity="false">
<level value="trace"/>
<appender-ref ref="GC" />
</logger>
<logger name="org.artifactory.storage.db.binstore.service" additivity="false">
<level value="trace"/>
<appender-ref ref="GC" />
</logger>
Then, you will see the number of candidates deleted from the trash can:gc.log:2021-05-05 16:02:06,240 [art-exec-281626] [INFO ] (o.a.s.b.s.GarbageCollectorInfo:89) - Storage garbage collector report:
gc.log-Total execution time: 1.57 minutes
gc.log-Candidates for deletion: 10,781
gc.log-Checksums deleted: 1,612
gc.log-Binaries deleted: 1,612
gc.log-Total size freed: 29.54 GB
gc.log-Unique paths deleted: 0
gc.log-Unique names deleted: 0
gc.log-2021-05-05 16:02:06,240 [art-exec-281626] [DEBUG] (o.a.s.d.b.s.g.GarbageCollector:105) - Finished working on GC batch for provider 'TRASH_AND_BINARIES'.