Update of /cvsroot/freenet/freenet/src/freenet/node
In directory sc8-pr-cvs1:/tmp/cvs-serv14443/src/freenet/node

Modified Files:
        Main.java Node.java 
Log Message:
reject queries when messageSendTimeRequest over 1000ms. Indenting.


Index: Main.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/Main.java,v
retrieving revision 1.274
retrieving revision 1.275
diff -u -w -r1.274 -r1.275
--- Main.java   21 Oct 2003 23:16:22 -0000      1.274
+++ Main.java   22 Oct 2003 10:45:59 -0000      1.275
@@ -95,8 +95,6 @@
        
     private static final Config switches = new Config();
        
-    public static boolean doRequestTriageByDelay = true;
-       
     static {
                //System.err.println("Main.java static initialization start.");
                // If this is moved further down the file, it may run after
@@ -1496,8 +1494,6 @@
                        Core.successInsertDistribution = new KeyHistogram();
                }
 
-               doRequestTriageByDelay = params.getBoolean("doRequestTriageByDelay");
-        
         // Not here, this get's called after
         // Node.init()
                //overloadLow = params.getFloat("overloadLow");

Index: Node.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/Node.java,v
retrieving revision 1.226
retrieving revision 1.227
diff -u -w -r1.226 -r1.227
--- Node.java   20 Oct 2003 16:37:54 -0000      1.226
+++ Node.java   22 Oct 2003 10:45:59 -0000      1.227
@@ -205,23 +205,26 @@
         config.addOption("logOutboundRequests",  1, false,   3530);
                config.addOption("logInboundInsertRequestDist",1,false,3541);
                config.addOption("logSuccessfulInsertRequestDist",1,false,3546);
-               config.addOption("doRequestTriageByDelay", 1, true, 3251);
+               config.addOption("doRequestTriageByDelay", 1, true, 3250);
+               config.addOption("doRequestTriageBySendTime",1,true,3251);
                config.addOption("overloadLow",1,0.85f,3252);
                config.addOption("overloadHigh",1,0.9f,3253);
                config.addOption("requestDelayCutoff",1,1000,3254);
                config.addOption("successfulDelayCutoff",1,2000,3255);
-               config.addOption("doOutLimitCutoff",1,true,3256);
-               config.addOption("outLimitCutoff",1,0.8F,3257);
-               config.addOption("doOutLimitConnectCutoff",1,true,3258);
-               config.addOption("outLimitConnectCutoff",1,2.0F,3259);
-               config.addOption("lowLevelBWLimitFudgeFactor",1,3F/4F,3260);
-               config.addOption("lowLevelBWLimitMultiplier",1,1.2F,3261);
-               config.addOption("doLowLevelOutputLimiting",1,true,3262);
-               config.addOption("doLowLevelInputLimiting",1,true,3263);
+               config.addOption("requestSendTimeCutoff", 1, 1000, 3256);
+               config.addOption("successfulSendTimeCutoff", 1, 4000, 3257);
+               config.addOption("doOutLimitCutoff",1,true,3258);
+               config.addOption("outLimitCutoff",1,0.8F,3259);
+               config.addOption("doOutLimitConnectCutoff",1,true,3260);
+               config.addOption("outLimitConnectCutoff",1,2.0F,3261);
+               config.addOption("lowLevelBWLimitFudgeFactor",1,3F/4F,3262);
+               config.addOption("lowLevelBWLimitMultiplier",1,1.2F,3263);
+               config.addOption("doLowLevelOutputLimiting",1,true,3264);
+               config.addOption("doLowLevelInputLimiting",1,true,3265);
                // Commented out because of limited use and potential political 
problems i.e. not cross platform
                //      config.addOption("doCPULoad",1,false,3264);
-               config.addOption("sendingQueueLength",1,256,3265);
-               config.addOption("sendingQueueBytes",1,1492*8,3266);
+               config.addOption("sendingQueueLength",1,256,3266);
+               config.addOption("sendingQueueBytes",1,1492*8,3267);
                
                // WatchMe options.
                config.addOption("watchme", 1, false, 3541);
@@ -1145,6 +1148,11 @@
                                                  "the node from totally overwhelming 
the hardware it runs "+
                                                  "on, and slowing down the network in 
the process.");
        
+               config.setExpert("doRequestTriageBySendTime", true);
+               config.argDesc  ("doRequestTriageBySendTime", "true/false");
+               config.shortDesc("doRequestTriageBySendTime", "Triage requests if 
messageSendTimeRequest gets too high");
+               config.longDesc ("doRequestTriageBySendTime", "If true, when 
messageSendTimeRequest goes above 1000ms, nearly all incoming requests will be 
rejected. messageSendTime correlates with CPU and bandwidth usage, and if it is too 
high your node will not do any useful work anyway because the messages will time 
out.");
+               
                // overloadLow
                config.setExpert ("overloadLow", true);
                config.argDesc   ("overloadLow", "<float between 0 and 1>");
@@ -1169,6 +1177,16 @@
                config.shortDesc ("successfulDelayCutoff", "reject all queries above 
this routingTime");
                config.longDesc  ("successfulDelayCutoff", "The node will reject ALL 
incoming queries above this routingTime.");
        
+               // requestSendTimeCutoff
+               config.setExpert("requestSendTimeCutoff", true);
+               config.argDesc  ("requestSendTimeCutoff", "<true|false>");
+               config.shortDesc("requestSendTimeCutoff", "reject qeuries above this 
messageSendTimeRequest");
+               
+               // successfulSendTimeCutoff
+               config.setExpert("successfulSendTimeCutoff", true);
+               config.argDesc  ("successfulSendTimeCutoff", "<true|false>");
+               config.shortDesc("successfulSendTimeCutoff", "reject all queries above 
this messageSendTimeRequest");
+               
                // doOutLimitCutoff
                config.setExpert("doOutLimitCutoff", true);
                config.argDesc  ("doOutLimitCutoff", "<true|false>");
@@ -1790,8 +1808,12 @@
     static public int initialRequestHTL;
     static public float overloadLow;
     static public float overloadHigh;
+       static public boolean doRequestTriageByDelay;
+       static public boolean doRequestTriageBySendTime;
     static public int requestDelayCutoff;
     static public int successfulDelayCutoff;
+       static public int requestSendTimeCutoff;
+       static public int successfulSendTimeCutoff;
     static public double defaultResetProbability;
     static public int lsMaxTableSize;
     static public int lsAcceptRatioSamples;
@@ -2123,8 +2145,13 @@
 
         overloadLow = params.getFloat("overloadLow");
                overloadHigh = params.getFloat("overloadHigh");
+               doRequestTriageByDelay = params.getBoolean("doRequestTriageByDelay");
+               doRequestTriageBySendTime = 
+                       params.getBoolean("doRequestTriageBySendTime");
                requestDelayCutoff = params.getInt("requestDelayCutoff");
                successfulDelayCutoff = params.getInt("successfulDelayCutoff");
+               requestSendTimeCutoff = params.getInt("requestSendTimeCutoff");
+               successfulSendTimeCutoff = params.getInt("successfulSendTimeCutoff");
                defaultResetProbability = params.getDouble("defaultResetProbability");
                lsMaxTableSize = params.getInt("lsMaxTableSize");
                lsAcceptRatioSamples = params.getInt("lsAcceptRatioSamples");
@@ -2436,6 +2463,18 @@
                                return true; // Reject connections - emergency 
bwlimiting
                        }
                }
+               if (diagnostics != null && doRequestTriageByDelay) {
+                       double delay = diagnostics.getValue("routingTime",
+                                                                                      
         Diagnostics.MINUTE,
+                                                                                      
         Diagnostics.MEAN_VALUE);
+                       if(delay > successfulDelayCutoff) return true;
+               }
+               if (diagnostics != null && doRequestTriageBySendTime) {
+                       double delay = diagnostics.getValue("messageSendTimeRequest",
+                                                                                      
         Diagnostics.MINUTE,
+                                                                                      
         Diagnostics.MEAN_VALUE);
+                       if(delay > successfulSendTimeCutoff) return true;
+               }
                return false;
     }
     
@@ -2545,14 +2584,24 @@
                else 
                        ret = (double)activeJobs() / (double)maximumThreads;
                
-        if (diagnostics != null && Main.doRequestTriageByDelay) {
+        if (diagnostics != null && 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 > 0.0F && ret < delay) ret = delay;
+        }
+               
+               if (diagnostics != null && doRequestTriageBySendTime) {
+                       double delay = diagnostics.getValue("messageSendTimeRequest",
+                                                                                      
         Diagnostics.MINUTE,
+                                                                                      
         Diagnostics.MEAN_VALUE);
+                       delay = overloadLow +
+                               (1 - overloadLow) * (delay - requestSendTimeCutoff) /
+                               (successfulSendTimeCutoff - requestSendTimeCutoff);
+                       if(delay > 0.0F && ret < delay) ret = delay;
         }
        
                if (diagnostics != null && logOutputBytes && doOutLimitCutoff &&
@@ -2560,7 +2609,8 @@
                        double sent = diagnostics.getValue("outputBytes",
                                                                                       
    Diagnostics.MINUTE,
                                                                                       
    Diagnostics.COUNT_CHANGE);
-                       int limit = (int)(outputBandwidthLimit /* * 
lowLevelBWLimitFudgeFactor*/ * 60);
+                       int limit = (int)(outputBandwidthLimit 
+                                                         /* * 
lowLevelBWLimitFudgeFactor*/ * 60);
                        if(sent > (double)(outLimitCutoff * limit)) {
                                return 1.0f;
                        }

_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to