From 6b561429283529f33a625f5299b4eccdf74ff572 Mon Sep 17 00:00:00 2001 From: Andrew Hind Date: Fri, 31 Oct 2014 14:47:57 +0000 Subject: [PATCH] Fix for Bug ACE-3373 Approx transaction indexing time remaining: being incorrect. - node and acl estimates now use elapsed time - added estimated time to finish for content index based on elapsed time - time now include query, tracking loop, index commit and index warming amortized per unit of work (node, acl or content) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@89643 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/solr/tracker/TrackerStats.java | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/search-services/alfresco-solrclient-lib/source/java/org/alfresco/solr/tracker/TrackerStats.java b/search-services/alfresco-solrclient-lib/source/java/org/alfresco/solr/tracker/TrackerStats.java index 6fa12161d..8afc9b78e 100644 --- a/search-services/alfresco-solrclient-lib/source/java/org/alfresco/solr/tracker/TrackerStats.java +++ b/search-services/alfresco-solrclient-lib/source/java/org/alfresco/solr/tracker/TrackerStats.java @@ -47,6 +47,12 @@ public class TrackerStats ConcurrentHashMap docTransformationTimes = new ConcurrentHashMap(); ConcurrentHashMap nodeTimes = new ConcurrentHashMap(); + + ConcurrentHashMap elapsedNodeTimes = new ConcurrentHashMap(); + + ConcurrentHashMap elapsedAclTimes = new ConcurrentHashMap(); + + ConcurrentHashMap elapsedContentTimes = new ConcurrentHashMap(); private InformationServer infoSrv; @@ -165,6 +171,21 @@ public class TrackerStats { return aggregateResults(nodeTimes).getMean(); } + + public double getMeanNodeElapsedIndexTime() + { + return aggregateResults(elapsedNodeTimes).getMean(); + } + + public double getMeanAclElapsedIndexTime() + { + return aggregateResults(elapsedAclTimes).getMean(); + } + + public double getMeanContentElapsedIndexTime() + { + return aggregateResults(elapsedContentTimes).getMean(); + } public double getNodeIndexingThreadCount() { @@ -787,6 +808,66 @@ public class TrackerStats stats.add(time); } + /** + * @param docCount + * @param l + */ + public void addElapsedNodeTime(int docCount, long time) + { + IncrementalStats stats = elapsedNodeTimes.get(Thread.currentThread().getName()); + if (stats == null) + { + stats = new IncrementalStats(TIME_SCALE, 50, this.infoSrv); + elapsedNodeTimes.put(Thread.currentThread().getName(), stats); + } + long meanTime = time / docCount; + for(int i = 0; i < docCount; i++) + { + stats.add(meanTime); + } + + } + + /** + * @param docCount + * @param l + */ + public void addElapsedAclTime(int docCount, long time) + { + IncrementalStats stats = elapsedAclTimes.get(Thread.currentThread().getName()); + if (stats == null) + { + stats = new IncrementalStats(TIME_SCALE, 50, this.infoSrv); + elapsedAclTimes.put(Thread.currentThread().getName(), stats); + } + long meanTime = time / docCount; + for(int i = 0; i < docCount; i++) + { + stats.add(meanTime); + } + + } + + /** + * @param docCount + * @param l + */ + public void addElapsedContentTime(int docCount, long time) + { + IncrementalStats stats = elapsedContentTimes.get(Thread.currentThread().getName()); + if (stats == null) + { + stats = new IncrementalStats(TIME_SCALE, 50, this.infoSrv); + elapsedContentTimes.put(Thread.currentThread().getName(), stats); + } + long meanTime = time / docCount; + for(int i = 0; i < docCount; i++) + { + stats.add(meanTime); + } + + } + /** * @param size */ @@ -854,4 +935,5 @@ public class TrackerStats nodeTimes.clear(); } + }