You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2015/05/14 20:27:37 UTC
svn commit: r1679424 -
/uima/sandbox/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/NodeAgent.java
Author: cwiklik
Date: Thu May 14 18:27:37 2015
New Revision: 1679424
URL: http://svn.apache.org/r1679424
Log:
UIMA-4387 Modified rules to determine which process to kill if swap becomes low. Kill a process which uses the most swap (in absolute terms) and is also over its swap limit.
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/NodeAgent.java
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/NodeAgent.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/NodeAgent.java?rev=1679424&r1=1679423&r2=1679424&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/NodeAgent.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-agent/src/main/java/org/apache/uima/ducc/agent/NodeAgent.java Thu May 14 18:27:37 2015
@@ -660,6 +660,18 @@ public class NodeAgent extends AbstractD
}
return false;
}
+ private long getSwapOverLimit(IDuccProcess process) {
+ long overLimit = 0;
+ for (ManagedProcess deployedProcess : deployedProcesses) {
+ if ( deployedProcess.getDuccProcess().getDuccId().equals(process.getDuccId()) ) {
+ overLimit = deployedProcess.getMaxSwapThreshold() - process.getSwapUsage();
+ }
+ }
+ if ( overLimit < 0 ) {
+ overLimit = 0;
+ }
+ return overLimit;
+ }
/**
* Called when swap space on a node reached minimum as defined by ducc.node.min.swap.threshold in
* ducc.properties. The agent will find the biggest (in terms of memory) process in its inventory
@@ -670,12 +682,12 @@ public class NodeAgent extends AbstractD
IDuccProcess biggestProcess = null;
try {
inventorySemaphore.acquire();
- // find the fattest process
+ // find the fattest process in terms of absolute use of swap over the process limit
for (Entry<DuccId, IDuccProcess> processEntry : getInventoryRef().entrySet()) {
- if (isProcessRunning(processEntry.getValue()) &&
- isOverSwapLimit(processEntry.getValue())
- && (biggestProcess == null || biggestProcess.getResidentMemory() < processEntry
- .getValue().getResidentMemory())) {
+ if (isProcessRunning(processEntry.getValue())
+ && isOverSwapLimit(processEntry.getValue())
+ && (biggestProcess == null
+ || getSwapOverLimit(biggestProcess) < getSwapOverLimit(processEntry.getValue()))) {
biggestProcess = processEntry.getValue();
}
}