You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by tm...@apache.org on 2020/01/15 20:09:45 UTC
[sling-org-apache-sling-distribution-journal] branch master
updated: SLING-8968 - Parametrise publisher queue cache parameters for
large producers
This is an automated email from the ASF dual-hosted git repository.
tmaret pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-journal.git
The following commit(s) were added to refs/heads/master by this push:
new a773e97 SLING-8968 - Parametrise publisher queue cache parameters for large producers
a773e97 is described below
commit a773e972d6412edc2a9650fbf46faec62f16eee6
Author: tmaret <tm...@adobe.com>
AuthorDate: Wed Jan 15 21:09:26 2020 +0100
SLING-8968 - Parametrise publisher queue cache parameters for large producers
---
.../journal/impl/queue/impl/PubQueueCacheService.java | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/sling/distribution/journal/impl/queue/impl/PubQueueCacheService.java b/src/main/java/org/apache/sling/distribution/journal/impl/queue/impl/PubQueueCacheService.java
index 5ba6d6b..2d865f9 100644
--- a/src/main/java/org/apache/sling/distribution/journal/impl/queue/impl/PubQueueCacheService.java
+++ b/src/main/java/org/apache/sling/distribution/journal/impl/queue/impl/PubQueueCacheService.java
@@ -50,6 +50,12 @@ public class PubQueueCacheService implements Runnable {
private static final Logger LOG = LoggerFactory.getLogger(PubQueueCacheService.class);
/**
+ * The minimum size to collect the cache. Each cache entry requires
+ * around 500B of heap space. 10'000 entries ~= 5MB on heap.
+ */
+ private static final int CLEANUP_THRESHOLD = 10_000;
+
+ /**
* Will cause the cache to be cleared when we loose the journal
*/
@Reference
@@ -105,12 +111,12 @@ public class PubQueueCacheService implements Runnable {
private void cleanup() {
if (cache != null) {
int size = cache.size();
- if (size > 1000) {
- LOG.info("Cleanup package cache (size={})", size);
+ if (size > CLEANUP_THRESHOLD) {
+ LOG.info("Cleanup package cache (size={}/{})", size, CLEANUP_THRESHOLD);
cache.close();
cache = newCache();
} else {
- LOG.info("No cleanup required for package cache (size={})", size);
+ LOG.info("No cleanup required for package cache (size={}/{})", size, CLEANUP_THRESHOLD);
}
}
}