|
From: <b_...@us...> - 2008-07-31 15:13:07
|
Revision: 2124
http://cogkit.svn.sourceforge.net/cogkit/?rev=2124&view=rev
Author: b_z_c
Date: 2008-07-31 15:12:59 +0000 (Thu, 31 Jul 2008)
Log Message:
-----------
delayBase parameter to control how much delay will be applied to a poorly
performing site.
Modified Paths:
--------------
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/WeightedHost.java
trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/WeightedHostScoreScheduler.java
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/WeightedHost.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/WeightedHost.java 2008-07-30 16:26:30 UTC (rev 2123)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/WeightedHost.java 2008-07-31 15:12:59 UTC (rev 2124)
@@ -28,6 +28,7 @@
private double delayedDelta;
private float jobThrottle;
private long lastUsed;
+ private double delayBase;
public WeightedHost(BoundContact contact, float jobThrottle) {
this(contact, 0.0, jobThrottle);
@@ -38,10 +39,15 @@
}
public WeightedHost(BoundContact contact, double score, int load, float jobThrottle) {
+ this(contact, score, load, jobThrottle, 2);
+ }
+
+ public WeightedHost(BoundContact contact, double score, int load, float jobThrottle, double delayBase) {
this.host = contact;
setScore(score);
this.load = load;
this.jobThrottle = jobThrottle;
+ this.delayBase = delayBase;
}
protected void setScore(double score) {
@@ -155,7 +161,7 @@
// based on time.
long now = System.currentTimeMillis();
long delay = now - lastUsed;
- long permittedDelay = (long) (Math.exp(-(score.doubleValue())) * 100.0);
+ long permittedDelay = (long) (Math.pow(delayBase, -(score.doubleValue())) * 100.0);
boolean overloaded = (delay < permittedDelay);
int d = (int) (delay - permittedDelay);
// tscore of -1 will give delay of around
Modified: trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/WeightedHostScoreScheduler.java
===================================================================
--- trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/WeightedHostScoreScheduler.java 2008-07-30 16:26:30 UTC (rev 2123)
+++ trunk/current/src/cog/modules/karajan/src/org/globus/cog/karajan/scheduler/WeightedHostScoreScheduler.java 2008-07-31 15:12:59 UTC (rev 2124)
@@ -43,6 +43,7 @@
public static final String SCORE_HIGH_CAP = "scoreHighCap";
public static final String POLICY = "policy";
public static final String JOB_THROTTLE = "jobThrottle";
+ public static final String DELAY_BASE = "delayBase";
public static final String MAX_SUBMISSION_TIME = "maxSubmissionTime";
private WeightedHostSet sorted;
@@ -57,6 +58,8 @@
private float defaultJobThrottle;
+ private double defaultDelayBase;
+
private double submissionTimeBias, submissionTimeFactor;
private boolean change;
@@ -81,6 +84,7 @@
failureFactor = -0.5;
scoreHighCap = 100;
defaultJobThrottle = 2;
+ defaultDelayBase = 2;
maxSubmissionTime = 20;
updateInternal();
}
@@ -109,17 +113,20 @@
while (i.hasNext()) {
BoundContact contact = (BoundContact) i.next();
float thisJobThrottle = defaultJobThrottle;
+ double thisDelayBase = defaultDelayBase;
+ double thisInitialScore = 0;
// TODO constants instead of these literals
if(contact.hasProperty(JOB_THROTTLE)) {
thisJobThrottle = floatThrottleValue(contact.getProperty(JOB_THROTTLE));
}
+ if(contact.hasProperty(DELAY_BASE)) {
+ thisDelayBase = Double.parseDouble((String)contact.getProperty(DELAY_BASE));
+ }
WeightedHost wh;
if(contact.hasProperty(INITIAL_SCORE)) {
- double thisInitialScore = Double.parseDouble((String)contact.getProperty(INITIAL_SCORE));
- wh = new WeightedHost(contact, thisInitialScore, thisJobThrottle);
- } else {
- wh = new WeightedHost(contact, thisJobThrottle);
+ thisInitialScore = Double.parseDouble((String)contact.getProperty(INITIAL_SCORE));
}
+ wh = new WeightedHost(contact, thisInitialScore, 0, thisJobThrottle, thisDelayBase);
addToSorted(wh);
}
}
@@ -342,6 +349,9 @@
else if (JOB_THROTTLE.equals(name)) {
defaultJobThrottle = floatThrottleValue(value);
}
+ else if (DELAY_BASE.equals(name)) {
+ defaultDelayBase = Double.parseDouble((String)value);
+ }
else {
double val = TypeUtil.toDouble(value);
try {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|