mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
added statistic information for solr resources in PerformanceMemory
This commit is contained in:
parent
931541d198
commit
e8bdf16ea7
|
@ -74,6 +74,29 @@
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
<p><strong>Solr Resources:</strong></p>
|
||||
<table border="0" cellpadding="2" cellspacing="1">
|
||||
<tr class="TableHeader" valign="bottom">
|
||||
<td>Class</td>
|
||||
<td>Type</td>
|
||||
<td>Description</td>
|
||||
<td>Statistics</td>
|
||||
<td>Size</td>
|
||||
</tr>
|
||||
#{SolrList}#
|
||||
<tr class="TableCellLight">
|
||||
<td align="left" class="TableCellDark">#[class]#</td>
|
||||
<td align="left" class="TableCellDark">#[type]#</td>
|
||||
<td align="left">#[description]#</td>
|
||||
<td align="left">#[statistics]#</td>
|
||||
<td align="right">#[size]#</td>
|
||||
</tr>
|
||||
#{/SolrList}#
|
||||
<tr class="TableCellDark">
|
||||
<td colspan="5">Total Cache Count = #[SolrCacheCount]#</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p><strong>Table RAM Index:</strong></p>
|
||||
<table border="0" cellpadding="2" cellspacing="1">
|
||||
<tr class="TableHeader" valign="bottom">
|
||||
|
|
|
@ -26,10 +26,14 @@
|
|||
|
||||
//import java.util.Iterator;
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.solr.core.SolrInfoMBean;
|
||||
import org.apache.solr.search.SolrCache;
|
||||
|
||||
import net.yacy.cora.protocol.Domains;
|
||||
import net.yacy.cora.protocol.RequestHeader;
|
||||
import net.yacy.cora.util.ConcurrentLog;
|
||||
|
@ -52,6 +56,8 @@ public class PerformanceMemory_p {
|
|||
|
||||
public static serverObjects respond(@SuppressWarnings("unused") final RequestHeader header, final serverObjects post, final serverSwitch env) {
|
||||
// return variable that accumulates replacements
|
||||
Switchboard sb = (Switchboard) env;
|
||||
|
||||
final serverObjects prop = new serverObjects();
|
||||
if (defaultSettings == null) {
|
||||
defaultSettings = FileUtils.loadMap(new File(env.getAppPath(), "defaults/yacy.init"));
|
||||
|
@ -103,11 +109,28 @@ public class PerformanceMemory_p {
|
|||
prop.putNum("memoryUsedAfterInitAGC", (memoryTotalAfterInitAGC - memoryFreeAfterInitAGC) / KB);
|
||||
prop.putNum("memoryUsedNow", MemoryControl.used() / MB);
|
||||
|
||||
|
||||
Collection<SolrInfoMBean> solrCaches = sb.index.fulltext().getSolrInfoBeans();
|
||||
int c = 0;
|
||||
int scc = 0;
|
||||
for (SolrInfoMBean sc: solrCaches) {
|
||||
prop.put("SolrList_" + c + "_class", sc.getName());
|
||||
prop.put("SolrList_" + c + "_type", sc instanceof SolrCache ? ((SolrCache<?,?>)sc).name() : "");
|
||||
prop.put("SolrList_" + c + "_description", sc.getDescription());
|
||||
prop.put("SolrList_" + c + "_statistics", sc.getStatistics() == null ? "" : sc.getStatistics().toString().replaceAll(",", ", "));
|
||||
prop.put("SolrList_" + c + "_size", sc instanceof SolrCache ? Integer.toString(((SolrCache<?,?>)sc).size()) : "");
|
||||
if (sc instanceof SolrCache) scc++;
|
||||
c++;
|
||||
}
|
||||
prop.put("SolrList", c);
|
||||
prop.put("SolrCacheCount", scc);
|
||||
|
||||
// write table for Table index sizes
|
||||
Iterator<String> i = Table.filenames();
|
||||
String filename;
|
||||
Map<Table.StatKeys, String> mapx;
|
||||
int p, c = 0;
|
||||
int p;
|
||||
c = 0;
|
||||
long mem, totalmem = 0;
|
||||
while (i.hasNext()) {
|
||||
filename = i.next();
|
||||
|
|
|
@ -23,6 +23,7 @@ package net.yacy.cora.federate.solr.connector;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
@ -82,7 +83,7 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCo
|
|||
|
||||
private final SearchHandler requestHandler;
|
||||
private final EmbeddedInstance instance;
|
||||
private SolrCore core;
|
||||
private final SolrCore core;
|
||||
|
||||
public EmbeddedSolrConnector(EmbeddedInstance instance) {
|
||||
super();
|
||||
|
@ -109,6 +110,10 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCo
|
|||
return 0;
|
||||
}
|
||||
|
||||
public Collection<SolrInfoMBean> getSolrInfoBeans() {
|
||||
return this.core.getInfoRegistry().values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCaches() {
|
||||
SolrConfig solrConfig = this.core.getSolrConfig();
|
||||
|
|
|
@ -75,6 +75,7 @@ import net.yacy.search.schema.WebgraphSchema;
|
|||
import org.apache.solr.common.SolrDocument;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
import org.apache.solr.core.SolrInfoMBean;
|
||||
import org.apache.lucene.util.Version;
|
||||
|
||||
public final class Fulltext {
|
||||
|
@ -133,14 +134,12 @@ public final class Fulltext {
|
|||
}
|
||||
|
||||
EmbeddedInstance localCollectionInstance = new EmbeddedInstance(new File(new File(Switchboard.getSwitchboard().appPath, "defaults"), "solr"), solrLocation, CollectionSchema.CORE_NAME, new String[]{CollectionSchema.CORE_NAME, WebgraphSchema.CORE_NAME});
|
||||
EmbeddedSolrConnector localCollectionConnector = new EmbeddedSolrConnector(localCollectionInstance);
|
||||
|
||||
Version luceneVersion = localCollectionConnector.getConfig().getLuceneVersion("luceneMatchVersion");
|
||||
Version luceneVersion = localCollectionInstance.getDefaultCore().getSolrConfig().getLuceneVersion("luceneMatchVersion");
|
||||
String lvn = luceneVersion.name();
|
||||
ConcurrentLog.info("Fulltext", "using lucene version " + lvn);
|
||||
int p = lvn.indexOf('_');
|
||||
assert SOLR_PATH.endsWith(lvn.substring(p)) : "luceneVersion = " + lvn + ", solrPath = " + SOLR_PATH + ", p = " + p + ", check defaults/solr/solrconfig.xml";
|
||||
ConcurrentLog.info("Fulltext", "connected solr in " + solrLocation.toString() + ", lucene version " + lvn + ", default core size: " + localCollectionConnector.getSize());
|
||||
ConcurrentLog.info("Fulltext", "connected solr in " + solrLocation.toString() + ", lucene version " + lvn);
|
||||
this.solrInstances.connectEmbedded(localCollectionInstance);
|
||||
}
|
||||
|
||||
|
@ -197,6 +196,12 @@ public final class Fulltext {
|
|||
}
|
||||
}
|
||||
|
||||
public Collection<SolrInfoMBean> getSolrInfoBeans() {
|
||||
EmbeddedSolrConnector esc = this.solrInstances.getDefaultEmbeddedConnector();
|
||||
if (esc == null) return new ArrayList<SolrInfoMBean>(0);
|
||||
return esc.getSolrInfoBeans();
|
||||
}
|
||||
|
||||
public int bufferSize() {
|
||||
return this.solrInstances.bufferSize();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user