(This is a slightly changed retransmission)
When a freenet node hits overloadLow, it starts rejecting requests. It
will reject anything that doesn't fit
((ft.contains(searchKey) || ds.contains(searchKey)).
This is a rather rough approach. Instead I have decided to be gentler,
and give requests another chance. When load hits overloadLow (which I
have personally set low, at 0.5), requests that do not fit the above
expression still have a chance to get through; a high chance if the load
is just over overloadLow, and a low chance if load is close to
overloadHigh.
Once load passes overloadHigh, requests that do not fit the above
expression are simply rejected. The rest still have a chance, unless
load becomes 1 (which, alas, happens much too often). Again the chance
gets smaller as load increases.
In theory this kinder, gentler approach should lead to a smoother
performance with fewer load spikes, as well as world peace. The code is
attached, sf CVS is still broken.
A test jar for the curious is available at
http://amorsen.dk/freenet-probabilistic-4.jar
The jar includes modifications to NewRequest.java, to make rejection
easier and more efficient. (In freenet, rejection is hardest on the one
doing the rejecting...)
A patch to build 6162 is attached.
/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
@@ -2420,15 +2428,36 @@
return true;
}
- // Node is slightly overloaded
- if ((load < overloadHigh) &&
- (ft.contains(searchKey) ||
- ds.contains(searchKey))) {
- if (inboundRequests != null) {
- inboundRequests.incSuccesses(diagAddr);
+ // Node is loaded
+ if (load < overloadHigh) {
+ if ((ft.contains(searchKey) || ds.contains(searchKey))) {
+ if (inboundRequests != null) {
+ inboundRequests.incSuccesses(diagAddr);
+ }
+ return true;
+ } else {
+ // Give the request another chance
+ if (Math.random() * (overloadHigh - overloadLow) + overloadLow < load)
{
+ if (inboundRequests != null) {
+ inboundRequests.incSuccesses(diagAddr);
+ }
+ return true;
+ }
}
- return true;
- }
+ return false;
+ }
+
+ // Node is seriously loaded
+ if (load < 1) {
+ if ((ft.contains(searchKey) || ds.contains(searchKey))) {
+ if (Math.random() * (1 - overloadHigh) + overloadHigh < load) {
+ if (inboundRequests != null) {
+ inboundRequests.incSuccesses(diagAddr);
+ }
+ return true;
+ }
+ }
+ }
// Node is overloaded
return false;
_______________________________________________
Devl mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/devl