Skip to content

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

- fast result for local search in case that less than 10 hits exists - small change in display of RAM in profiling

orbiter54c7cbf1d9d1
diff --git a/htroot/Threaddump_p.java b/htroot/Threaddump_p.java
index b64344f39..5308294ca 100644
--- a/htroot/Threaddump_p.java
+++ b/htroot/Threaddump_p.java
@@ -63,13 +63,14 @@ public class Threaddump_p {
// Thread dump
final Date dt = new Date();
final String versionstring = yacyBuildProperties.getVersion() + "/" + yacyBuildProperties.getSVNRevision();
+ Runtime runtime = Runtime.getRuntime();
bufferappend(buffer, plain, "************* Start Thread Dump " + dt + " *******************");
bufferappend(buffer, plain, "");
bufferappend(buffer, plain, "YaCy Version: " + versionstring);
- bufferappend(buffer, plain, "Total Memory = " + (Runtime.getRuntime().totalMemory()));
- bufferappend(buffer, plain, "Used  Memory = " + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
- bufferappend(buffer, plain, "Free  Memory = " + (Runtime.getRuntime().freeMemory()));
+ bufferappend(buffer, plain, "Assigned   Memory = " + (runtime.maxMemory()));
+ bufferappend(buffer, plain, "Used       Memory = " + (runtime.totalMemory() - runtime.freeMemory()));
+ bufferappend(buffer, plain, "Available  Memory = " + (runtime.maxMemory() - runtime.totalMemory() + runtime.freeMemory()));
bufferappend(buffer, plain, "");
bufferappend(buffer, plain, "");
diff --git a/source/de/anomic/search/RankingProcess.java b/source/de/anomic/search/RankingProcess.java
index 3694ca0f0..12800b8ea 100644
--- a/source/de/anomic/search/RankingProcess.java
+++ b/source/de/anomic/search/RankingProcess.java
@@ -358,7 +358,7 @@ public final class RankingProcess extends Thread {
return bestEntry;
}
- public URLMetadataRow takeURL(final boolean skipDoubleDom, final long timeout) {
+ public URLMetadataRow takeURL(final boolean skipDoubleDom, final int timeout) {
// returns from the current RWI list the best URL entry and removes this entry from the list
long timeLimit = System.currentTimeMillis() + timeout;
while (System.currentTimeMillis() < timeLimit) {
diff --git a/source/de/anomic/search/ResultFetcher.java b/source/de/anomic/search/ResultFetcher.java
index f01a9d96f..5bbab43c4 100644
--- a/source/de/anomic/search/ResultFetcher.java
+++ b/source/de/anomic/search/ResultFetcher.java
@@ -62,19 +62,21 @@ public class ResultFetcher {
protected final TreeSet<byte[]> snippetFetchWordHashes; // a set of word hashes that are used to match with the snippets
long urlRetrievalAllTime;
long snippetComputationAllTime;
-
+ int taketimeout;
@SuppressWarnings("unchecked")
public ResultFetcher(
RankingProcess rankedCache,
final QueryParams query,
final Segment indexSegment,
- final yacySeedDB peers) {
+ final yacySeedDB peers,
+ final int taketimeout) {
this.rankedCache = rankedCache;
this.query = query;
this.indexSegment = indexSegment;
this.peers = peers;
+ this.taketimeout = taketimeout;
this.urlRetrievalAllTime = 0;
this.snippetComputationAllTime = 0;
@@ -157,7 +159,7 @@ public class ResultFetcher {
if ((query.contentdom != QueryParams.CONTENTDOM_IMAGE) && (result.size() >= query.neededResults() + fetchAhead)) break;
// get next entry
- page = rankedCache.takeURL(true, 10000);
+ page = rankedCache.takeURL(true, taketimeout);
if (page == null) break;
if (result.exists(page.hash().hashCode())) continue;
if (failedURLs.get(page.hash()) != null) continue;
diff --git a/source/de/anomic/search/SearchEvent.java b/source/de/anomic/search/SearchEvent.java
index 04dcf4f07..66c000025 100644
--- a/source/de/anomic/search/SearchEvent.java
+++ b/source/de/anomic/search/SearchEvent.java
@@ -147,7 +147,8 @@ public final class SearchEvent {
Log.logFine("SEARCH_EVENT", "NO SEARCH STARTED DUE TO EMPTY SEARCH REQUEST.");
}
-
+ // start worker threads to fetch urls and snippets
+ this.results = new ResultFetcher(rankedCache, query, indexSegment, peers, 10000);
} else {
// do a local search
this.rankedCache = new RankingProcess(indexSegment, query, max_results_preparation, 2);
@@ -180,11 +181,11 @@ public final class SearchEvent {
}
serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "abstract generation", this.rankedCache.searchContainerMap().size(), System.currentTimeMillis() - timer), false);
}
+
+ // start worker threads to fetch urls and snippets
+ this.results = new ResultFetcher(rankedCache, query, indexSegment, peers, 10);
}
-
- // start worker threads to fetch urls and snippets
- this.results = new ResultFetcher(rankedCache, query, indexSegment, peers);
-
+
// clean up events
SearchEventCache.cleanupEvents(false);
serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(query.id(true), "event-cleanup", 0, 0), false);