more memory control:

- catchup of OutOfMemoryError in server threads
- automatic adoption of word cache size after a Short Mem Cycle

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2426 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent 3e9d509c39
commit 39b4c26bdc

@ -255,7 +255,7 @@ public class PerformanceQueues_p {
prop.put("maxAgeOfKCache", "" + (switchboard.wordIndex.maxAgeOfKCache() / 1000 / 60)); // minutes prop.put("maxAgeOfKCache", "" + (switchboard.wordIndex.maxAgeOfKCache() / 1000 / 60)); // minutes
prop.put("minAgeOfKCache", "" + (switchboard.wordIndex.minAgeOfKCache() / 1000 / 60)); // minutes prop.put("minAgeOfKCache", "" + (switchboard.wordIndex.minAgeOfKCache() / 1000 / 60)); // minutes
prop.put("maxWaitingWordFlush", switchboard.getConfig("maxWaitingWordFlush", "180")); prop.put("maxWaitingWordFlush", switchboard.getConfig("maxWaitingWordFlush", "180"));
prop.put("wordCacheMaxCount", switchboard.getConfig("wordCacheMaxCount", "10000")); prop.put("wordCacheMaxCount", switchboard.wordIndex.getMaxWordCount());
prop.put("onlineCautionDelay", switchboard.getConfig("onlineCautionDelay", "30000")); prop.put("onlineCautionDelay", switchboard.getConfig("onlineCautionDelay", "30000"));
prop.put("onlineCautionDelayCurrent", System.currentTimeMillis() - switchboard.proxyLastAccess); prop.put("onlineCautionDelayCurrent", System.currentTimeMillis() - switchboard.proxyLastAccess);

@ -944,7 +944,10 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public void deQueueFreeMem() { public void deQueueFreeMem() {
// flush some entries from the RAM cache // flush some entries from the RAM cache
wordIndex.flushCacheSome(); wordIndex.flushCacheSome();
wordIndex.flushCacheSome(); // adopt maximum cache size to current size to prevent that further OutOfMemoryErrors occur
int newMaxCount = Math.max(2000, Math.min(wordIndex.getMaxWordCount(), wordIndex.wSize()));
setConfig("wordCacheMaxCount", Integer.toString(newMaxCount));
wordIndex.setMaxWordCount(newMaxCount);
} }
public boolean deQueue() { public boolean deQueue() {

@ -74,7 +74,7 @@ public final class serverInstantThread extends serverAbstractThread implements s
if (freemem == null) if (freemem == null)
this.freememExecMethod = null; this.freememExecMethod = null;
else else
this.freememExecMethod = env.getClass().getMethod(jobCount, new Class[0]); this.freememExecMethod = env.getClass().getMethod(freemem, new Class[0]);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
throw new RuntimeException("serverInstantThread, wrong declaration of freemem: " + e.getMessage()); throw new RuntimeException("serverInstantThread, wrong declaration of freemem: " + e.getMessage());
@ -109,16 +109,20 @@ public final class serverInstantThread extends serverAbstractThread implements s
if (result == null) jobHasDoneSomething = true; if (result == null) jobHasDoneSomething = true;
else if (result instanceof Boolean) jobHasDoneSomething = ((Boolean) result).booleanValue(); else if (result instanceof Boolean) jobHasDoneSomething = ((Boolean) result).booleanValue();
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
serverLog.logSevere("SERVER", "Internal Error in serverInstantThread: " + e.getMessage()); serverLog.logSevere("SERVER", "Internal Error in serverInstantThread.job: " + e.getMessage());
serverLog.logSevere("SERVER", "shutting down thread '" + this.getName() + "'"); serverLog.logSevere("SERVER", "shutting down thread '" + this.getName() + "'");
this.terminate(false); this.terminate(false);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
serverLog.logSevere("SERVER", "Internal Error in serverInstantThread: " + e.getMessage()); serverLog.logSevere("SERVER", "Internal Error in serverInstantThread.job: " + e.getMessage());
serverLog.logSevere("SERVER", "shutting down thread '" + this.getName() + "'"); serverLog.logSevere("SERVER", "shutting down thread '" + this.getName() + "'");
this.terminate(false); this.terminate(false);
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
serverLog.logSevere("SERVER", "Runtime Error in serverInstantThread, thread '" + this.getName() + "': " + e.getMessage() + "; target exception: " + e.getTargetException().getMessage(), e.getTargetException()); serverLog.logSevere("SERVER", "Runtime Error in serverInstantThread.job, thread '" + this.getName() + "': " + e.getMessage() + "; target exception: " + e.getTargetException().getMessage(), e.getTargetException());
e.getTargetException().printStackTrace(); e.getTargetException().printStackTrace();
} catch (OutOfMemoryError e) {
serverLog.logSevere("SERVER", "OutOfMemory Error in serverInstantThread.job, thread '" + this.getName() + "': " + e.getMessage());
e.printStackTrace();
freemem();
} }
instantThreadCounter--; instantThreadCounter--;
return jobHasDoneSomething; return jobHasDoneSomething;
@ -129,16 +133,19 @@ public final class serverInstantThread extends serverAbstractThread implements s
try { try {
freememExecMethod.invoke(environment, new Object[0]); freememExecMethod.invoke(environment, new Object[0]);
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
serverLog.logSevere("SERVER", "Internal Error in serverInstantThread: " + e.getMessage()); serverLog.logSevere("SERVER", "Internal Error in serverInstantThread.freemem: " + e.getMessage());
serverLog.logSevere("SERVER", "shutting down thread '" + this.getName() + "'"); serverLog.logSevere("SERVER", "shutting down thread '" + this.getName() + "'");
this.terminate(false); this.terminate(false);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
serverLog.logSevere("SERVER", "Internal Error in serverInstantThread: " + e.getMessage()); serverLog.logSevere("SERVER", "Internal Error in serverInstantThread.freemem: " + e.getMessage());
serverLog.logSevere("SERVER", "shutting down thread '" + this.getName() + "'"); serverLog.logSevere("SERVER", "shutting down thread '" + this.getName() + "'");
this.terminate(false); this.terminate(false);
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
serverLog.logSevere("SERVER", "Runtime Error in serverInstantThread, thread '" + this.getName() + "': " + e.getMessage() + "; target exception: " + e.getTargetException().getMessage(), e.getTargetException()); serverLog.logSevere("SERVER", "Runtime Error in serverInstantThread.freemem, thread '" + this.getName() + "': " + e.getMessage() + "; target exception: " + e.getTargetException().getMessage(), e.getTargetException());
e.getTargetException().printStackTrace(); e.getTargetException().printStackTrace();
} catch (OutOfMemoryError e) {
serverLog.logSevere("SERVER", "OutOfMemory Error in serverInstantThread.freemem, thread '" + this.getName() + "': " + e.getMessage());
e.printStackTrace();
} }
} }

Loading…
Cancel
Save