mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
- fast result for local search in case that less than 10 hits exists
- small change in display of RAM in profiling git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6326 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
28d4b921b6
commit
54c7cbf1d9
|
@ -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, "");
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user