SOLR-666 -- Expose warmup time in statistics for SolrIndexSearcher and LRUCache

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@680916 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2008-07-30 06:09:16 +00:00
parent 909aab1576
commit a18aea63f1
3 changed files with 13 additions and 2 deletions

View File

@ -327,6 +327,8 @@ New Features
63. SOLR-256: Support exposing Solr statistics through JMX (Sharad Agrawal, shalin)
64. SOLR-666: Expose warmup time in statistics for SolrIndexSearcher and LRUCache (shalin)
Changes in runtime behavior
1. SOLR-559: use Lucene updateDocument, deleteDocuments methods. This

View File

@ -52,6 +52,8 @@ public class LRUCache implements SolrCache {
private long inserts;
private long evictions;
private long warmupTime = 0;
private Map map;
private String name;
private int autowarmCount;
@ -156,7 +158,7 @@ public class LRUCache implements SolrCache {
public void warm(SolrIndexSearcher searcher, SolrCache old) throws IOException {
if (regenerator==null) return;
long warmingStartTime = System.currentTimeMillis();
LRUCache other = (LRUCache)old;
// warm entries
@ -197,6 +199,8 @@ public class LRUCache implements SolrCache {
}
}
}
warmupTime = System.currentTimeMillis() - warmingStartTime;
}
@ -262,6 +266,8 @@ public class LRUCache implements SolrCache {
lst.add("size", map.size());
}
lst.add("warmupTime", warmupTime);
long clookups = stats.lookups.get();
long chits = stats.hits.get();
lst.add("cumulative_lookups", clookups);

View File

@ -61,6 +61,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
private final String name;
private long openTime = System.currentTimeMillis();
private long registerTime = 0;
private long warmupTime = 0;
private final IndexSearcher searcher;
private final IndexReader reader;
private final boolean closeReader;
@ -1510,13 +1511,14 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
public void warm(SolrIndexSearcher old) throws IOException {
// Make sure this is first! filters can help queryResults execute!
boolean logme = log.isLoggable(Level.INFO);
long warmingStartTime = System.currentTimeMillis();
// warm the caches in order...
for (int i=0; i<cacheList.length; i++) {
if (logme) log.info("autowarming " + this + " from " + old + "\n\t" + old.cacheList[i]);
this.cacheList[i].warm(this, old.cacheList[i]);
if (logme) log.info("autowarming result for " + this + "\n\t" + this.cacheList[i]);
}
warmupTime = System.currentTimeMillis() - warmingStartTime;
}
/**
@ -1589,6 +1591,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
lst.add("indexVersion", reader.getVersion());
lst.add("openedAt", new Date(openTime));
if (registerTime!=0) lst.add("registeredAt", new Date(registerTime));
lst.add("warmupTime", warmupTime);
return lst;
}