Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

enhanced search event logging (to be used for further improvements)

orbiter64860dc1bb3d
diff --git a/htroot/PerformanceSearch_p.html b/htroot/PerformanceSearch_p.html
index c060750d9..bcf879c61 100644
--- a/htroot/PerformanceSearch_p.html
+++ b/htroot/PerformanceSearch_p.html
@@ -14,8 +14,9 @@
</p>
<table border="0" cellpadding="2" cellspacing="1">
<tr class="TableHeader" valign="bottom">
- <td>Query</td>
+ <td>Query</td>
<td>Event</td>
+ <td>Comment</td>
<td>Time</td>
<td>Delta (ms)</td>
<td>Duration (ms)</td>
@@ -23,8 +24,9 @@
</tr>
#{table}#
<tr class="TableCellDark" valign="bottom">
- <td>#[query]#</td>
+ <td>#[query]#</td>
<td>#[event]#</td>
+ <td>#[comment]#</td>
<td>#[time]#</td>
<td>#[delta]#</td>
<td>#[duration]#</td>
@@ -34,7 +36,10 @@
</table>
<p>
- The network picture below shows how the latest search query was solved by asking corresponding peers in the DHT:
+ The network picture below shows how the latest search query was solved by asking corresponding peers in the DHT:<br/>
+ red -> request list alive<br/>
+ green -> request has terminated<br/>
+ grey -> the search target hash order position(s) (more targets if a dht partition is used)<br/>
<img src="SearchEventPicture.png" alt="Search event picture" />
</p>
#%env/templates/footer.template%#
diff --git a/htroot/PerformanceSearch_p.java b/htroot/PerformanceSearch_p.java
index 2acaae1bd..c83c9db5d 100644
--- a/htroot/PerformanceSearch_p.java
+++ b/htroot/PerformanceSearch_p.java
@@ -40,7 +40,7 @@ public class PerformanceSearch_p {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
- final Iterator<EventTracker.Event> events = EventTracker.getHistory("SEARCH");
+ final Iterator<EventTracker.Event> events = EventTracker.getHistory(EventTracker.EClass.SEARCH);
int c = 0;
if (events != null) {
EventTracker.Event event;
@@ -50,7 +50,8 @@ public class PerformanceSearch_p {
event = events.next();
search = (ProfilingGraph.searchEvent) event.payload;
prop.put("table_" + c + "_query", search.queryID);
- prop.put("table_" + c + "_event", search.processName);
+ prop.put("table_" + c + "_event", search.processName.name());
+ prop.put("table_" + c + "_comment", search.comment);
prop.putNum("table_" + c + "_count", search.resultCount);
prop.putNum("table_" + c + "_delta", event.time - lastt);
prop.put("table_" + c + "_time", (new Date(event.time)).toString());
diff --git a/htroot/yacy/search.java b/htroot/yacy/search.java
index 6281adcce..5e30c4e78 100644
--- a/htroot/yacy/search.java
+++ b/htroot/yacy/search.java
@@ -229,7 +229,7 @@ public final class search {
//final Map<byte[], ReferenceContainer<WordReference>>[] containers = sb.indexSegment.index().searchTerm(theQuery.queryHashes, theQuery.excludeHashes, plasmaSearchQuery.hashes2StringSet(urls));
final TreeMap<byte[], ReferenceContainer<WordReference>> incc = indexSegment.termIndex().searchConjunction(theQuery.queryHashes, QueryParams.hashes2Handles(urls));
- EventTracker.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.COLLECTION, incc.size(), System.currentTimeMillis() - timer), false, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.Type.COLLECTION, "", incc.size(), System.currentTimeMillis() - timer), false);
if (incc != null) {
final Iterator<Map.Entry<byte[], ReferenceContainer<WordReference>>> ci = incc.entrySet().iterator();
Map.Entry<byte[], ReferenceContainer<WordReference>> entry;
@@ -345,7 +345,7 @@ public final class search {
refstr.append(",").append(e.name);
}
prop.put("references", (refstr.length() > 0) ? refstr.substring(1) : refstr.toString());
- EventTracker.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), "reference collection", ws.size(), System.currentTimeMillis() - timer), false, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.Type.REFERENCECOLLECTION, "", ws.size(), System.currentTimeMillis() - timer), false);
}
prop.put("indexabstract", indexabstract.toString());
@@ -372,7 +372,7 @@ public final class search {
}
prop.put("links", links.toString());
prop.put("linkcount", accu.size());
- EventTracker.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), "result list preparation", accu.size(), System.currentTimeMillis() - timer), false, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.Type.RESULTLIST, "", accu.size(), System.currentTimeMillis() - timer), false);
}
// add information about forward peers
diff --git a/htroot/yacysearch.java b/htroot/yacysearch.java
index 8f29244b8..220c651fb 100644
--- a/htroot/yacysearch.java
+++ b/htroot/yacysearch.java
@@ -488,7 +488,7 @@ public class yacysearch {
authenticated,
indexSegment,
ranking);
- EventTracker.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.INITIALIZATION, 0, 0), false, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.Type.INITIALIZATION, "", 0, 0), false);
// tell all threads to do nothing for a specific time
sb.intermissionAllThreads(3000);
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java
index 4c72c8fd6..453d26208 100644
--- a/htroot/yacysearchitem.java
+++ b/htroot/yacysearchitem.java
@@ -162,7 +162,7 @@ public class yacysearchitem {
}
prop.put("content_heuristic_name", heuristic.heuristicName);
}
- EventTracker.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.FINALIZATION + "-" + item, 0, 0), false, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.Type.FINALIZATION, "" + item, 0, 0), false);
return prop;
}
diff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.java
index 6729a831b..fab115901 100644
--- a/htroot/yacysearchtrailer.java
+++ b/htroot/yacysearchtrailer.java
@@ -182,7 +182,7 @@ public class yacysearchtrailer {
prop.put("cat-location_display", display);
}
- EventTracker.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.FINALIZATION + "-" + "bottomline", 0, 0), false, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.Type.FINALIZATION, "bottomline", 0, 0), false);
return prop;
}
diff --git a/source/de/anomic/search/DocumentIndex.java b/source/de/anomic/search/DocumentIndex.java
index 7011facd2..4658b7993 100644
--- a/source/de/anomic/search/DocumentIndex.java
+++ b/source/de/anomic/search/DocumentIndex.java
@@ -116,7 +116,7 @@ public class DocumentIndex extends Segment {
this.queue.clear();
}
- public URIMetadataRow add(DigestURI url) throws IOException {
+ private URIMetadataRow add(DigestURI url) throws IOException {
if (url == null) throw new IOException("file = null");
if (url.isDirectory()) throw new IOException("file should be a document, not a path");
if (!url.canRead()) throw new IOException("cannot read file");
@@ -136,7 +136,8 @@ public class DocumentIndex extends Segment {
url.length(),
document,
condenser,
- null
+ null,
+ DocumentIndex.class.getName() + ".add"
);
}
diff --git a/source/de/anomic/search/QueryParams.java b/source/de/anomic/search/QueryParams.java
index e6c6dce31..3a985a210 100644
--- a/source/de/anomic/search/QueryParams.java
+++ b/source/de/anomic/search/QueryParams.java
@@ -425,7 +425,7 @@ public final class QueryParams {
context.append(asterisk);
context.append(this.zonecode);
context.append(asterisk);
- context.append(Word.word2hash(this.ranking.toExternalString()));
+ context.append(new String(Word.word2hash(this.ranking.toExternalString())));
context.append(asterisk);
context.append(this.prefer);
context.append(asterisk);
diff --git a/source/de/anomic/search/RankingProcess.java b/source/de/anomic/search/RankingProcess.java
index 18e244fa0..738cdd2eb 100644
--- a/source/de/anomic/search/RankingProcess.java
+++ b/source/de/anomic/search/RankingProcess.java
@@ -95,7 +95,6 @@ public final class RankingProcess extends Thread {
this.localSearchInclusion = null;
this.stack = new WeakPriorityBlockingQueue<ReverseElement<WordReferenceVars>>(maxentries);
this.doubleDomCache = new ConcurrentHashMap<String, WeakPriorityBlockingQueue<ReverseElement<WordReferenceVars>>>();
- //this.handover = new HandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.getOrdering(), 0);
this.query = query;
this.order = order;
this.remote_peerCount = 0;
@@ -138,19 +137,19 @@ public final class RankingProcess extends Thread {
query.maxDistance);
this.localSearchInclusion = search.inclusion();
final ReferenceContainer<WordReference> index = search.joined();
- EventTracker.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), SearchEvent.JOIN, index.size(), System.currentTimeMillis() - timer), false, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(query.id(true), SearchEvent.Type.JOIN, query.queryString, index.size(), System.currentTimeMillis() - timer), false);
if (index.isEmpty()) {
return;
}
- add(index, true, -1);
+ add(index, true, "local index: " + this.query.getSegment().getLocation(), -1);
} catch (final Exception e) {
Log.logException(e);
}
oneFeederTerminated();
}
- public void add(final ReferenceContainer<WordReference> index, final boolean local, final int fullResource) {
+ public void add(final ReferenceContainer<WordReference> index, final boolean local, String resourceName, final int fullResource) {
// we collect the urlhashes and construct a list with urlEntry objects
// attention: if minEntries is too high, this method will not terminate within the maxTime
@@ -168,7 +167,7 @@ public final class RankingProcess extends Thread {
// normalize entries
final BlockingQueue<WordReferenceVars> decodedEntries = this.order.normalizeWith(index);
- EventTracker.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), SearchEvent.NORMALIZING, index.size(), System.currentTimeMillis() - timer), false, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(query.id(true), SearchEvent.Type.NORMALIZING, resourceName, index.size(), System.currentTimeMillis() - timer), false);
// iterate over normalized entries and select some that are better than currently stored
timer = System.currentTimeMillis();
@@ -248,7 +247,7 @@ public final class RankingProcess extends Thread {
} catch (InterruptedException e) {}
//if ((query.neededResults() > 0) && (container.size() > query.neededResults())) remove(true, true);
- EventTracker.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), SearchEvent.PRESORT, index.size(), System.currentTimeMillis() - timer), false, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(query.id(true), SearchEvent.Type.PRESORT, resourceName, index.size(), System.currentTimeMillis() - timer), false);
}
/**
diff --git a/source/de/anomic/search/ResultFetcher.java b/source/de/anomic/search/ResultFetcher.java
index fb7c87ed3..86e8d9a34 100644
--- a/source/de/anomic/search/ResultFetcher.java
+++ b/source/de/anomic/search/ResultFetcher.java
@@ -101,7 +101,7 @@ public class ResultFetcher {
// start worker threads to fetch urls and snippets
this.workerThreads = null;
deployWorker(Math.min(10, query.itemsPerPage), query.neededResults());
- EventTracker.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), this.workerThreads.length + " online snippet fetch threads started", 0, 0), false, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(query.id(true), SearchEvent.Type.SNIPPETFETCH_START, this.workerThreads.length + " online snippet fetch threads started", 0, 0), false);
}
public void deployWorker(int deployCount, int neededResults) {
@@ -276,10 +276,12 @@ public class ResultFetcher {
public ResultEntry oneResult(final int item) {
// check if we already retrieved this item
// (happens if a search pages is accessed a second time)
- EventTracker.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "obtain one result entry - start", 0, 0), false, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(query.id(true), SearchEvent.Type.ONERESULT, "started, item = " + item + ", available = " + this.result.sizeAvailable(), 0, 0), false);
if (this.result.sizeAvailable() > item) {
// we have the wanted result already in the result array .. return that
- return this.result.element(item).getElement();
+ ResultEntry re = this.result.element(item).getElement();
+ EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(query.id(true), SearchEvent.Type.ONERESULT, "prefetched, item = " + item + ", available = " + this.result.sizeAvailable() + ": " + re.urlstring(), 0, 0), false);
+ return re;
}
/*
System.out.println("rankedCache.size() = " + this.rankedCache.size());
@@ -303,8 +305,13 @@ public class ResultFetcher {
}
// finally, if there is something, return the result
- if (this.result.sizeAvailable() <= item) return null;
- return this.result.element(item).getElement();
+ if (this.result.sizeAvailable() <= item) {
+ EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(query.id(true), SearchEvent.Type.ONERESULT, "not found, item = " + item + ", available = " + this.result.sizeAvailable(), 0, 0), false);
+ return null;
+ }
+ ResultEntry re = this.result.element(item).getElement();
+ EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(query.id(true), SearchEvent.Type.ONERESULT, "retrieved, item = " + item + ", available = " + this.result.sizeAvailable() + ": " + re.urlstring(), 0, 0), false);
+ return re;
}
private int resultCounter = 0;
diff --git a/source/de/anomic/search/SearchEvent.java b/source/de/anomic/search/SearchEvent.java
index d0c2ec2a5..3098e857a 100644
--- a/source/de/anomic/search/SearchEvent.java
+++ b/source/de/anomic/search/SearchEvent.java
@@ -55,13 +55,10 @@ import de.anomic.yacy.graphics.ProfilingGraph;
public final class SearchEvent {
- public static final String INITIALIZATION = "initialization";
- public static final String COLLECTION = "collection";
- public static final String JOIN = "join";
- public static final String PRESORT = "presort";
- public static final String URLFETCH = "urlfetch";
- public static final String NORMALIZING = "normalizing";
- public static final String FINALIZATION = "finalization";
+ public enum Type {
+ INITIALIZATION, COLLECTION, JOIN, PRESORT, URLFETCH, NORMALIZING, FINALIZATION,
+ REMOTESEARCH_START, REMOTESEARCH_TERMINATE, ABSTRACTS, CLEANUP, SNIPPETFETCH_START, ONERESULT, REFERENCECOLLECTION, RESULTLIST;
+ }
public static final int max_results_preparation = 3000;
@@ -145,7 +142,7 @@ public final class SearchEvent {
(query.domType == QueryParams.SEARCHDOM_GLOBALDHT) ? null : preselectedPeerHashes);
if (this.primarySearchThreads != null) {
if (this.primarySearchThreads.length > fetchpeers) this.rankedCache.moreFeeders(this.primarySearchThreads.length - fetchpeers);
- EventTracker.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "remote search thread start", this.primarySearchThreads.length, System.currentTimeMillis() - timer), false, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(query.id(true), Type.REMOTESEARCH_START, "", this.primarySearchThreads.length, System.currentTimeMillis() - timer), false);
// finished searching
Log.logFine("SEARCH_EVENT", "SEARCH TIME AFTER GLOBAL-TRIGGER TO " + primarySearchThreads.length + " PEERS: " + ((System.currentTimeMillis() - start) / 1000) + " seconds");
} else {
@@ -185,7 +182,7 @@ public final class SearchEvent {
IACount.put(wordhash, Integer.valueOf(container.size()));
IAResults.put(wordhash, ReferenceContainer.compressIndex(container, null, 1000).toString());
}
- EventTracker.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "abstract generation", this.rankedCache.searchContainerMap().size(), System.currentTimeMillis() - timer), false, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(query.id(true), Type.ABSTRACTS, "", this.rankedCache.searchContainerMap().size(), System.currentTimeMillis() - timer), false);
}
// start worker threads to fetch urls and snippets
@@ -194,7 +191,7 @@ public final class SearchEvent {
// clean up events
SearchEventCache.cleanupEvents(false);
- EventTracker.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "event-cleanup", 0, 0), false, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.SEARCH, new ProfilingGraph.searchEvent(query.id(true), Type.CLEANUP, "", 0, 0), false);
// store this search to a cache so it can be re-used
if (MemoryControl.available() < 1024 * 1024 * 10) SearchEventCache.cleanupEvents(true);
diff --git a/source/de/anomic/search/Segment.java b/source/de/anomic/search/Segment.java
index ac1fc4fb7..4622b2225 100644
--- a/source/de/anomic/search/Segment.java
+++ b/source/de/anomic/search/Segment.java
@@ -205,7 +205,8 @@ public class Segment {
final char doctype,
final int outlinksSame,
final int outlinksOther,
- final SearchEvent searchEvent) {
+ final SearchEvent searchEvent,
+ final String sourceName) {
int wordCount = 0;
final int urlLength = url.toNormalform(true, true).length();
final int urlComps = MultiProtocolURI.urlComps(url.toString()).length;
@@ -247,7 +248,7 @@ public class Segment {
} catch (RowSpaceExceededException e) {
continue;
}
- searchEvent.getRankingResult().add(container, false, -1);
+ searchEvent.getRankingResult().add(container, false, sourceName, -1);
}
}
@@ -268,7 +269,8 @@ public class Segment {
final long sourcesize,
final Document document,
final Condenser condenser,
- final SearchEvent searchEvent
+ final SearchEvent searchEvent,
+ final String sourceName
) throws IOException {
final long startTime = System.currentTimeMillis();
@@ -359,7 +361,8 @@ public class Segment {
Response.docType(document.dc_format()), // document type
document.inboundLinks(), // inbound links
document.outboundLinks(), // outbound links
- searchEvent // a search event that can have results directly
+ searchEvent, // a search event that can have results directly
+ sourceName // the name of the source where the index was created
);
final long indexingEndTime = System.currentTimeMillis();
diff --git a/source/de/anomic/search/Segments.java b/source/de/anomic/search/Segments.java
index b550eb2e0..03a20a4b8 100644
--- a/source/de/anomic/search/Segments.java
+++ b/source/de/anomic/search/Segments.java
@@ -28,15 +28,10 @@ package de.anomic.search;
import java.io.File;
import java.io.IOException;
-import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import net.yacy.document.Condenser;
-import net.yacy.document.Document;
-import net.yacy.kelondro.data.meta.DigestURI;
-import net.yacy.kelondro.data.meta.URIMetadataRow;
import net.yacy.kelondro.data.word.WordReference;
import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.rwi.IndexCell;
@@ -200,29 +195,6 @@ public class Segments implements Iterable<Segment> {
public void finalize() {
this.close();
}
-
- public URIMetadataRow storeDocument(
- final String segmentName,
- final DigestURI url,
- final DigestURI referrerURL,
- final Date modDate,
- final Date loadDate,
- final long sourcesize,
- final Document document,
- final Condenser condenser,
- final SearchEvent searchEvent
- ) throws IOException {
- return segment(segmentName).storeDocument(
- url,
- referrerURL,
- modDate,
- loadDate,
- sourcesize,
- document,
- condenser,
- searchEvent
- );
- }
public synchronized Segment.ReferenceCleaner getReferenceCleaner(final String segmentName, final byte[] startHash) {
return segment(segmentName).getReferenceCleaner(startHash);
diff --git a/source/de/anomic/search/Switchboard.java b/source/de/anomic/search/Switchboard.java
index 07741f8a7..d881fc4af 100644
--- a/source/de/anomic/search/Switchboard.java
+++ b/source/de/anomic/search/Switchboard.java
@@ -159,7 +159,6 @@ import de.anomic.yacy.yacyUpdateLocation;
import de.anomic.yacy.yacyRelease;
import de.anomic.yacy.dht.Dispatcher;
import de.anomic.yacy.dht.PeerSelection;
-import de.anomic.yacy.graphics.ProfilingGraph;
import de.anomic.yacy.graphics.WebStructureGraph;
public final class Switchboard extends serverSwitch {
@@ -1866,12 +1865,12 @@ public final class Switchboard extends serverSwitch {
in.queueEntry.updateStatus(Response.QUEUE_STATE_INDEXSTORAGE);
// the condenser may be null in case that an indexing is not wanted (there may be a no-indexing flag in the file)
if (in.condenser != null) for (int i = 0; i < in.documents.length; i++) {
- storeDocumentIndex(in.process, in.queueEntry, in.documents[i], in.condenser[i], null);
+ storeDocumentIndex(in.process, in.queueEntry, in.documents[i], in.condenser[i], null, "crawler/indexing queue");
}
in.queueEntry.updateStatus(Response.QUEUE_STATE_FINISHED);
}
- private void storeDocumentIndex(final Segments.Process process, final Response queueEntry, final Document document, final Condenser condenser, final SearchEvent searchEvent) {
+ private void storeDocumentIndex(final Segments.Process process, final Response queueEntry, final Document document, final Condenser condenser, final SearchEvent searchEvent, String sourceName) {
// CREATE INDEX
final String dc_title = document.dc_title();
@@ -1905,7 +1904,8 @@ public final class Switchboard extends serverSwitch {
queueEntry.size(),
document,
condenser,
- searchEvent);
+ searchEvent,
+ sourceName);
yacyChannel.channels(Base64Order.enhancedCoder.equal(queueEntry.initiator(), peers.mySeed().hash.getBytes()) ? yacyChannel.LOCALINDEXING : yacyChannel.REMOTEINDEXING).addMessage(new RSSMessage("Indexed web page", dc_title, queueEntry.url().toNormalform(true, false)));
} catch (final IOException e) {
//if (this.log.isFine()) log.logFine("Not Indexed Resource '" + queueEntry.url().toNormalform(false, true) + "': process case=" + processCase);
@@ -1942,10 +1942,10 @@ public final class Switchboard extends serverSwitch {
if (System.currentTimeMillis() - lastPPMUpdate > 20000) {
// we don't want to do this too often
updateMySeed();
- EventTracker.update("ppm", Long.valueOf(currentPPM()), true, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.PPM, Long.valueOf(currentPPM()), true);
lastPPMUpdate = System.currentTimeMillis();
}
- EventTracker.update("indexed", queueEntry.url().toNormalform(true, false), false, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.INDEX, queueEntry.url().toNormalform(true, false), false);
// if this was performed for a remote crawl request, notify requester
if ((processCase == EventOrigin.GLOBAL_CRAWLING) && (queueEntry.initiator() != null)) {
@@ -2015,7 +2015,7 @@ public final class Switchboard extends serverSwitch {
Condenser condenser = new Condenser(document, true, true);
ResultImages.registerImages(url, document, true);
webStructure.generateCitationReference(url, document, condenser, response.lastModified());
- storeDocumentIndex(process, response, document, condenser, searchEvent);
+ storeDocumentIndex(process, response, document, condenser, searchEvent, "heuristic:" + heuristicName);
log.logInfo("addToIndex fill of url " + url.toNormalform(true, true) + " finished");
}
} catch (IOException e) {
@@ -2310,7 +2310,7 @@ public final class Switchboard extends serverSwitch {
}
public int currentPPM() {
- return EventTracker.countEvents("indexed", 20000) * 3;
+ return EventTracker.countEvents(EventTracker.EClass.INDEX, 20000) * 3;
}
public double averageQPM() {
diff --git a/source/de/anomic/yacy/graphics/NetworkGraph.java b/source/de/anomic/yacy/graphics/NetworkGraph.java
index fbb0666c8..0cde05e51 100644
--- a/source/de/anomic/yacy/graphics/NetworkGraph.java
+++ b/source/de/anomic/yacy/graphics/NetworkGraph.java
@@ -129,12 +129,13 @@ public class NetworkGraph {
// get dimensions
final int cr = Math.min(eventPicture.getWidth(), eventPicture.getHeight()) / 5 - 20;
final int cx = eventPicture.getWidth() / 2;
- final int cy = eventPicture.getHeight() / 2;
+ final int cy = eventPicture.getHeight() / 2 + 20;
int angle;
// draw in the primary search peers
for (int j = 0; j < primarySearches.length; j++) {
+ if (primarySearches[j] == null) continue;
eventPicture.setColor((primarySearches[j].isAlive()) ? RasterPlotter.RED : RasterPlotter.GREEN);
angle = (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(primarySearches[j].target().hash.getBytes(), null)) / ((double) Long.MAX_VALUE)));
eventPicture.arcLine(cx, cy, cr - 20, cr, angle);
@@ -143,6 +144,7 @@ public class NetworkGraph {
// draw in the secondary search peers
if (secondarySearches != null) {
for (int j = 0; j < secondarySearches.length; j++) {
+ if (secondarySearches[j] == null) continue;
eventPicture.setColor((secondarySearches[j].isAlive()) ? RasterPlotter.RED : RasterPlotter.GREEN);
angle = (int) (360.0 * (((double) FlatWordPartitionScheme.std.dhtPosition(secondarySearches[j].target().hash.getBytes(), null)) / ((double) Long.MAX_VALUE)));
eventPicture.arcLine(cx, cy, cr - 10, cr, angle - 1);
diff --git a/source/de/anomic/yacy/graphics/ProfilingGraph.java b/source/de/anomic/yacy/graphics/ProfilingGraph.java
index 9e9ddfdea..80b8e80cc 100644
--- a/source/de/anomic/yacy/graphics/ProfilingGraph.java
+++ b/source/de/anomic/yacy/graphics/ProfilingGraph.java
@@ -29,6 +29,8 @@ package de.anomic.yacy.graphics;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
+import de.anomic.search.SearchEvent;
+
import net.yacy.kelondro.util.EventTracker;
import net.yacy.kelondro.util.EventTracker.Event;
import net.yacy.visualization.RasterPlotter;
@@ -39,7 +41,7 @@ public class ProfilingGraph {
private static ChartPlotter bufferChart = null;
public static long maxTime = 600000L;
- public static long maxPayload(final String eventname, final long min) {
+ public static long maxPayload(final EventTracker.EClass eventname, final long min) {
final Iterator<Event> list = EventTracker.getHistory(eventname);
if (list == null) return min;
long max = min, l;
@@ -56,9 +58,9 @@ public class ProfilingGraph {
public static RasterPlotter performanceGraph(final int width, final int height, final String subline) {
// find maximum values for automatic graph dimension adoption
- final int maxppm = (int) maxPayload("ppm", 25);
- final int maxwords = (int) maxPayload("wordcache", 12000);
- final long maxbytes = maxPayload("memory", 110 * 1024 * 1024);
+ final int maxppm = (int) maxPayload(EventTracker.EClass.PPM, 25);
+ final int maxwords = (int) maxPayload(EventTracker.EClass.WORDCACHE, 12000);
+ final long maxbytes = maxPayload(EventTracker.EClass.MEMORY, 110 * 1024 * 1024);
final int maxmbytes = (int)(maxbytes / 1024 / 1024);
// declare graph and set dimensions
@@ -103,7 +105,7 @@ public class ProfilingGraph {
}
*/
// draw memory
- Iterator<Event> events = EventTracker.getHistory("memory");
+ Iterator<Event> events = EventTracker.getHistory(EventTracker.EClass.MEMORY);
x0 = 1; y0 = 0;
if (events != null) {
EventTracker.Event event;
@@ -122,7 +124,7 @@ public class ProfilingGraph {
}
// draw wordcache
- events = EventTracker.getHistory("wordcache");
+ events = EventTracker.getHistory(EventTracker.EClass.WORDCACHE);
x0 = 1; y0 = 0;
if (events != null) {
EventTracker.Event event;
@@ -141,7 +143,7 @@ public class ProfilingGraph {
}
// draw ppm
- events = EventTracker.getHistory("ppm");
+ events = EventTracker.getHistory(EventTracker.EClass.PPM);
x0 = 1; y0 = 0;
if (events != null) {
EventTracker.Event event;
@@ -168,13 +170,16 @@ public class ProfilingGraph {
}
public static class searchEvent {
- public String queryID, processName;
+ public SearchEvent.Type processName;
+ public String comment;
+ public String queryID;
public long duration;
public int resultCount;
- public searchEvent(final String queryID, final String processName, final int resultCount, final long duration) {
+ public searchEvent(final String queryID, final SearchEvent.Type processName, String comment, final int resultCount, final long duration) {
this.queryID = queryID;
this.processName = processName;
+ this.comment = comment;
this.resultCount = resultCount;
this.duration = duration;
}
diff --git a/source/de/anomic/yacy/yacyClient.java b/source/de/anomic/yacy/yacyClient.java
index d7b20d98c..4d0bc1856 100644
--- a/source/de/anomic/yacy/yacyClient.java
+++ b/source/de/anomic/yacy/yacyClient.java
@@ -551,7 +551,7 @@ public final class yacyClient {
// store remote result to local result container
// insert one container into the search result buffer
// one is enough, only the references are used, not the word
- containerCache.add(container[0], false, joincount);
+ containerCache.add(container[0], false, target.getName() + "/" + target.hash, joincount);
// insert the containers to the index
for (ReferenceContainer<WordReference> c: container) try {
diff --git a/source/net/yacy/kelondro/rwi/IndexCell.java b/source/net/yacy/kelondro/rwi/IndexCell.java
index 64ea25040..a050fa7b1 100644
--- a/source/net/yacy/kelondro/rwi/IndexCell.java
+++ b/source/net/yacy/kelondro/rwi/IndexCell.java
@@ -30,8 +30,6 @@ import java.io.File;
import java.io.IOException;
import java.util.concurrent.Semaphore;
-import de.anomic.yacy.graphics.ProfilingGraph;
-
import net.yacy.kelondro.data.meta.URIMetadataRow;
import net.yacy.kelondro.index.HandleSet;
import net.yacy.kelondro.index.Row;
@@ -113,11 +111,11 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu
this.ram.add(newEntries);
long t = System.currentTimeMillis();
if (this.ram.size() % 1000 == 0 || this.lastCleanup + cleanupCycle < t || this.lastDump + dumpCycle < t) {
- EventTracker.update("wordcache", Long.valueOf(this.ram.size()), true, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.WORDCACHE, Long.valueOf(this.ram.size()), true);
cleanCache();
}
} catch (RowSpaceExceededException e) {
- EventTracker.update("wordcache", Long.valueOf(this.ram.size()), true, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.WORDCACHE, Long.valueOf(this.ram.size()), true);
cleanCache();
this.ram.add(newEntries);
}
@@ -129,11 +127,11 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu
this.ram.add(termHash, entry);
long t = System.currentTimeMillis();
if (this.ram.size() % 1000 == 0 || this.lastCleanup + cleanupCycle < t || this.lastDump + dumpCycle < t) {
- EventTracker.update("wordcache", Long.valueOf(this.ram.size()), true, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.WORDCACHE, Long.valueOf(this.ram.size()), true);
cleanCache();
}
} catch (RowSpaceExceededException e) {
- EventTracker.update("wordcache", Long.valueOf(this.ram.size()), true, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.WORDCACHE, Long.valueOf(this.ram.size()), true);
cleanCache();
this.ram.add(termHash, entry);
}
diff --git a/source/net/yacy/kelondro/util/EventTracker.java b/source/net/yacy/kelondro/util/EventTracker.java
index 50a2b642c..b96cc9ebb 100644
--- a/source/net/yacy/kelondro/util/EventTracker.java
+++ b/source/net/yacy/kelondro/util/EventTracker.java
@@ -31,17 +31,25 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
+import de.anomic.yacy.graphics.ProfilingGraph;
+
public class EventTracker {
- private final static Map<String, ConcurrentLinkedQueue<Event>> historyMaps = new ConcurrentHashMap<String, ConcurrentLinkedQueue<Event>>();
- private final static Map<String, Long> eventAccess = new ConcurrentHashMap<String, Long>(); // value: last time when this was accessed
+ private final static int maxQueueSize = 30000;
+ private final static long maxQueueAge = ProfilingGraph.maxTime;
+
+ public enum EClass {
+ WORDCACHE,
+ MEMORY,
+ PPM,
+ INDEX,
+ SEARCH;
+ }
+
+ private final static Map<EClass, ConcurrentLinkedQueue<Event>> historyMaps = new ConcurrentHashMap<EClass, ConcurrentLinkedQueue<Event>>();
+ private final static Map<EClass, Long> eventAccess = new ConcurrentHashMap<EClass, Long>(); // value: last time when this was accessed
- public final static void update(
- final String eventName,
- final Object eventPayload,
- boolean useProtection,
- int maxQueueSize,
- long maxQueueAge) {
+ public final static void update(final EClass eventName, final Object eventPayload, boolean useProtection) {
// check protection against too heavy access
if (useProtection) {
Long lastAcc = eventAccess.get(eventName);
@@ -92,13 +100,13 @@ public class EventTracker {
}
}
- public final static Iterator<Event> getHistory(final String eventName) {
+ public final static Iterator<Event> getHistory(final EClass eventName) {
ConcurrentLinkedQueue<Event> list = historyMaps.get(eventName);
if (list == null) return null;
return list.iterator();
}
- public final static int countEvents(final String eventName, long time) {
+ public final static int countEvents(final EClass eventName, long time) {
Iterator<Event> event = getHistory(eventName);
if (event == null) return 0;
long now = System.currentTimeMillis();
diff --git a/source/net/yacy/kelondro/util/MemoryTracker.java b/source/net/yacy/kelondro/util/MemoryTracker.java
index 0dc95e250..7d6e87b33 100644
--- a/source/net/yacy/kelondro/util/MemoryTracker.java
+++ b/source/net/yacy/kelondro/util/MemoryTracker.java
@@ -26,8 +26,6 @@
package net.yacy.kelondro.util;
-import de.anomic.yacy.graphics.ProfilingGraph;
-
import net.yacy.kelondro.logging.Log;
public class MemoryTracker extends Thread {
@@ -54,7 +52,7 @@ public class MemoryTracker extends Thread {
public void run() {
try {
while (running) {
- EventTracker.update("memory", Long.valueOf(MemoryControl.used()), true, 30000, ProfilingGraph.maxTime);
+ EventTracker.update(EventTracker.EClass.MEMORY, Long.valueOf(MemoryControl.used()), true);
try {
Thread.sleep(this.delaytime);
} catch (final InterruptedException e) {