- changed snippet fetch strategy logic: do not check if entry is in cache. This should reduce IO load on the HTCACHE which is a showstopper during large number of search requests

- forced a possible short memory status when a search is started to flush caches that may cause search-heaps with resource contention effects

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7747 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 14 years ago
parent 4bea3f9714
commit dbea40d536

@ -133,6 +133,7 @@ public class SearchEventCache {
// start a new event // start a new event
boolean delete = Switchboard.getSwitchboard() == null | Switchboard.getSwitchboard().getConfigBool("search.verify.delete", true); boolean delete = Switchboard.getSwitchboard() == null | Switchboard.getSwitchboard().getConfigBool("search.verify.delete", true);
event = new SearchEvent(query, peers, workTables, preselectedPeerHashes, generateAbstracts, loader, remote_maxcount, remote_maxtime, burstRobinsonPercent, burstMultiwordPercent, delete); event = new SearchEvent(query, peers, workTables, preselectedPeerHashes, generateAbstracts, loader, remote_maxcount, remote_maxtime, burstRobinsonPercent, burstMultiwordPercent, delete);
MemoryControl.request(100 * 1024 * 1024, false); // this may trigger a short memory status which causes a reducing of cache space of other threads
} }
return event; return event;

@ -179,21 +179,19 @@ public class TextSnippet implements Comparable<TextSnippet>, Comparator<TextSnip
// first try to get the snippet from metadata // first try to get the snippet from metadata
String loc; String loc;
boolean noCacheUsage = url.isFile() || url.isSMB() || cacheStrategy == null; boolean noCacheUsage = url.isFile() || url.isSMB() || cacheStrategy == null;
boolean objectWasInCache = (noCacheUsage) ? false : de.anomic.http.client.Cache.has(url); if (containsAllHashes(loc = comp.dc_title(), queryhashes)) {
boolean useMetadata = !objectWasInCache && (cacheStrategy == null || !cacheStrategy.mustBeOffline());
if (useMetadata && containsAllHashes(loc = comp.dc_title(), queryhashes)) {
// try to create the snippet from information given in the url itself // try to create the snippet from information given in the url itself
init(url.hash(), loc, ResultClass.SOURCE_METADATA, null); init(url.hash(), loc, ResultClass.SOURCE_METADATA, null);
return; return;
} else if (useMetadata && containsAllHashes(loc = comp.dc_creator(), queryhashes)) { } else if (containsAllHashes(loc = comp.dc_creator(), queryhashes)) {
// try to create the snippet from information given in the creator metadata // try to create the snippet from information given in the creator metadata
init(url.hash(), loc, ResultClass.SOURCE_METADATA, null); init(url.hash(), loc, ResultClass.SOURCE_METADATA, null);
return; return;
} else if (useMetadata && containsAllHashes(loc = comp.dc_subject(), queryhashes)) { } else if (containsAllHashes(loc = comp.dc_subject(), queryhashes)) {
// try to create the snippet from information given in the subject metadata // try to create the snippet from information given in the subject metadata
init(url.hash(), loc, ResultClass.SOURCE_METADATA, null); init(url.hash(), loc, ResultClass.SOURCE_METADATA, null);
return; return;
} else if (useMetadata && containsAllHashes(loc = comp.url().toNormalform(true, true).replace('-', ' '), queryhashes)) { } else if (containsAllHashes(loc = comp.url().toNormalform(true, true).replace('-', ' '), queryhashes)) {
// try to create the snippet from information given in the url // try to create the snippet from information given in the url
init(url.hash(), loc, ResultClass.SOURCE_METADATA, null); init(url.hash(), loc, ResultClass.SOURCE_METADATA, null);
return; return;
@ -210,8 +208,7 @@ public class TextSnippet implements Comparable<TextSnippet>, Comparator<TextSnip
// if it is still not available, report an error // if it is still not available, report an error
init(url.hash(), null, ResultClass.ERROR_RESOURCE_LOADING, "error loading resource from net, no cache entry"); init(url.hash(), null, ResultClass.ERROR_RESOURCE_LOADING, "error loading resource from net, no cache entry");
return; return;
} } else {
if (!objectWasInCache) {
// place entry on indexing queue // place entry on indexing queue
Switchboard.getSwitchboard().toIndexer(response); Switchboard.getSwitchboard().toIndexer(response);
source = ResultClass.SOURCE_WEB; source = ResultClass.SOURCE_WEB;

@ -170,7 +170,7 @@ public class MemoryControl {
} }
public static boolean shortStatus() { public static boolean shortStatus() {
if (shortStatus) System.out.println("**** SHORT MEMORY ****"); //if (shortStatus) System.out.println("**** SHORT MEMORY ****");
return shortStatus; return shortStatus;
} }

Loading…
Cancel
Save