Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

95693: Merged 5.0.N (5.0.1) to HEAD-BUG-FIX (5.1/Cloud)
      94442: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.1)
         94393: Merged DEV (4.2.5) to V4.2-BUG-FIX (4.2.5)
            94233: MNT-12802: CachingContentStore Quota & Performance
            Made the quota thresholds configurable.
            Introduced a property to configure a gap between normal cleanups.
            Changed cachingContentStoreCache configuration.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@95698 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-02-02 10:05:36 +00:00
parent f0546e3819
commit 8c6c739a5e
4 changed files with 44 additions and 3 deletions

View File

@@ -62,7 +62,10 @@ public class StandardQuotaStrategy implements QuotaManagerStrategy, UsageTracker
private int cleanThresholdPct = 80;
private int targetUsagePct = 70;
private long maxUsageBytes = 0;
/* Threshold in seconds indicating a minimal gap between normal cleanup starts */
private long normalCleanThresholdSec = 0;
private AtomicLong currentUsageBytes = new AtomicLong(0);
private AtomicLong lastCleanupStart = new AtomicLong(0);
private CachedContentCleaner cleaner;
private ContentCacheImpl cache; // impl specific functionality required
private int maxFileSizeMB = 0;
@@ -89,6 +92,8 @@ public class StandardQuotaStrategy implements QuotaManagerStrategy, UsageTracker
}
loadDiskUsage();
// Set the time to start the normal clean
lastCleanupStart.set(System.currentTimeMillis() - normalCleanThresholdSec);
// Run the cleaner thread so that it can update the disk usage more accurately.
signalCleanerStart("quota (init)");
}
@@ -226,7 +231,19 @@ public class StandardQuotaStrategy implements QuotaManagerStrategy, UsageTracker
}
else
{
cleaner.execute(reason);
long timePassedFromLastClean = System.currentTimeMillis() - lastCleanupStart.get();
if (timePassedFromLastClean < normalCleanThresholdSec * 1000)
{
if (log.isDebugEnabled())
{
log.debug("Skipping a normal clean as it is too soon. The last cleanup was run " + timePassedFromLastClean/1000f + " seconds ago.");
}
}
else
{
lastCleanupStart.set(System.currentTimeMillis());
cleaner.execute(reason);
}
}
}
@@ -294,7 +311,16 @@ public class StandardQuotaStrategy implements QuotaManagerStrategy, UsageTracker
this.cleanThresholdPct = cleanThresholdPct;
}
public void setTargetUsagePct(int targetUsagePct)
{
this.targetUsagePct = targetUsagePct;
}
public void setNormalCleanThresholdSec(long normalCleanThresholdSec)
{
this.normalCleanThresholdSec = normalCleanThresholdSec;
}
@Required
public void setCache(ContentCacheImpl cache)
{