(This is a slightly changed retransmission)

Right now (build 6161) the load seems to fluctuate between ~0% and 100%.
This causes a stop-and-go effect which I think is detrimental.

I have changed the load calculation entirely. It now works by estimated
spare capacity for the three causes of load, and multiplying those
values. The load is then (1 - spare capacity).

For maximumThreads it adds a fudge factor of 25% of maximumThreads, so
the first tasks do not contribute to the load. 100% load is achieved
when activeJobs equals maximumThreads.

It compares routingTime to successfulDelayCutoff. If routingTime is
higher, it returns 100% load. If on the other hand routingTime is below
requestDelayCutoff, it does not contribute to the load at all. This
means that requestDelayCutoff should be set significantly lower than it
is today. Perhaps 50 or 100. Another option is to remove it from the
calculation entirely, saying that any routingTime > 0 contributes to the
load.

Last it looks at the bandwidth compared to (outputBandwidthLimit *
outLimitCutoff). The load contribution is simply the proportion.
Arguably there should be a configurable minimal bandwidth, below which
bandwidth does not contribute to load.

Attached is a patch to build 6162.


/Benny


--- freenet-orig/src/freenet/node/Node.java     2003-08-23 02:06:59.000000000 +0200
+++ freenet/src/freenet/node/Node.java  2003-08-22 20:34:39.000000000 +0200
@@ -2361,41 +2361,49 @@
      *
      **/
     public final float estimatedLoad() {
-       double ret;
+       double spare = 1;
 
         int maximumThreads = threadFactory.maximumThreads();
 
-       if (maximumThreads <= 0) 
-           ret = 0;
-       else 
-           ret = (double)activeJobs() / (double)maximumThreads;
-       
+       if (maximumThreads > 0) {
+           // This should be *=, but we know that spare is 1 here
+           // It is assumed that 25% of the max. threads are just background tasks
+           // which do not contribute significantly to the load
+           spare = 1.25 * (1 - (double)activeJobs() / (double)maximumThreads);
+           if (spare > 1) {
+               spare = 1;
+           } else if (spare < 0) {
+               spare = 0;
+           }
+       }
+
         if (diagnostics != null && Main.doRequestTriageByDelay) {
             double delay = diagnostics.getValue("routingTime",
                                                Diagnostics.MINUTE,
                                                Diagnostics.MEAN_VALUE);
-            delay = overloadLow + 
-               (1-overloadLow) * (delay - requestDelayCutoff) / 
-               (successfulDelayCutoff - requestDelayCutoff);
-            if (delay > overloadLow && ret < delay) ret = delay;
-        }
+           if (delay > successfulDelayCutoff) {
+               spare = 0;
+           } else if (delay > requestDelayCutoff) {
+               spare *= 1d - (delay - requestDelayCutoff) / (successfulDelayCutoff - 
requestDelayCutoff);
+           }
        
+        }
+
        if (diagnostics != null && logOutputBytes && doOutLimitCutoff &&
            obw != null) {
            double sent = diagnostics.getValue("outputBytes",
                                               Diagnostics.MINUTE,
                                               Diagnostics.COUNT_CHANGE);
-           int limit = (int)(outputBandwidthLimit /* * lowLevelBWLimitFudgeFactor*/ * 
60);
-           if(sent > (double)(outLimitCutoff * limit)) {
-               return 1.0f;
+           
+           double limit = outputBandwidthLimit * outLimitCutoff * 60;
+           if ( sent > limit ) {
+               spare = 0;
+           } else {
+               spare *= 1d - (sent / limit);
            }
        }
-       
-        if (ret > 1.0f) {
-            return 1.0f;
-        }
 
-        return (float)ret;
+        return (float)(1f-spare);
     }
  
     /**
_______________________________________________
Devl mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/devl

Reply via email to