diff --git a/history.txt b/history.txt
index be4c46e3db..f61fa11486 100644
--- a/history.txt
+++ b/history.txt
@@ -1,3 +1,7 @@
+2009-05-27 Mathiasdm
+ * Increase sendProcessingTime some more, add a property to configure.
+ Configure with 'router.defaultProcessingTimeThrottle'.
+
2009-05-27 Mathiasdm
* Increased sendProcessingTime limits and added testSuccessTime
to avoid unwanted throttling
diff --git a/router/java/nbproject/project.xml b/router/java/nbproject/project.xml
index 0b1c4e8ad2..3947ad82ac 100644
--- a/router/java/nbproject/project.xml
+++ b/router/java/nbproject/project.xml
@@ -10,6 +10,11 @@
i2p_router
+
+
+ .
+ UTF-8
+
java
@@ -22,11 +27,6 @@
test
UTF-8
-
-
- .
- UTF-8
-
@@ -73,6 +73,7 @@
+
diff --git a/router/java/src/net/i2p/router/RouterThrottleImpl.java b/router/java/src/net/i2p/router/RouterThrottleImpl.java
index 24f1f6856f..214753db25 100644
--- a/router/java/src/net/i2p/router/RouterThrottleImpl.java
+++ b/router/java/src/net/i2p/router/RouterThrottleImpl.java
@@ -33,6 +33,8 @@ class RouterThrottleImpl implements RouterThrottle {
private static final String PROP_MAX_TUNNELS = "router.maxParticipatingTunnels";
private static final int DEFAULT_MAX_TUNNELS = 2000;
private static final String PROP_DEFAULT_KBPS_THROTTLE = "router.defaultKBpsThrottle";
+ private static final String PROP_MAX_PROCESSINGTIME = "router.defaultProcessingTimeThrottle";
+ private static final int DEFAULT_MAX_PROCESSINGTIME = 1500;
/** tunnel acceptance */
public static final int TUNNEL_ACCEPT = 0;
@@ -96,33 +98,17 @@ class RouterThrottleImpl implements RouterThrottle {
return TunnelHistory.TUNNEL_REJECT_BANDWIDTH;
long lag = _context.jobQueue().getMaxLag();
-// reject here if lag too high???
+ // reject here if lag too high???
+
RateStat rs = _context.statManager().getRate("transport.sendProcessingTime");
Rate r = null;
- if (rs != null)
- r = rs.getRate(60*1000);
- double processTime = (r != null ? r.getAverageValue() : 0);
- if (processTime > 5000) {
- if (_log.shouldLog(Log.DEBUG))
- _log.debug("Refusing tunnel request with the job lag of " + lag
- + "since the 1 minute message processing time is too slow (" + processTime + ")");
- _context.statManager().addRateData("router.throttleTunnelProcessingTime1m", (long)processTime, (long)processTime);
- setTunnelStatus("Rejecting tunnels: High message delay");
- return TunnelHistory.TUNNEL_REJECT_TRANSIENT_OVERLOAD;
- }
//Reject tunnels if the time to process messages and send them is too large. Too much time implies congestion.
- Rate r2 = _context.statManager().getRate("tunnel.testSuccessTime").getRate(60*1000);
- if(r != null && r2 != null) {
+ if(r != null) {
double totalSendProcessingTimeEvents = r.getCurrentEventCount() + r.getLastEventCount();
double avgSendProcessingTime = 0;
double currentSendProcessingTime = 0;
double lastSendProcessingTime = 0;
-
- double totalTestSuccessTimeEvents = r2.getCurrentEventCount() + r2.getLastEventCount();
- double avgTestSuccessTime = 0;
- double currentTestSuccessTime = 0;
- double lastTestSuccessTime = 0;
//Calculate times
if(r.getCurrentEventCount() > 0) {
@@ -141,25 +127,12 @@ class RouterThrottleImpl implements RouterThrottle {
}
}
- if(r2.getCurrentEventCount() > 0) {
- currentTestSuccessTime = r2.getCurrentTotalValue()/r.getCurrentEventCount();
- }
- if(r2.getLastEventCount() > 0) {
- lastTestSuccessTime = r2.getLastTotalValue()/r2.getLastEventCount();
- }
- if(totalTestSuccessTimeEvents > 0) {
- avgTestSuccessTime = (r2.getCurrentTotalValue() + r.getLastTotalValue())/totalTestSuccessTimeEvents;
- }
- else {
- avgTestSuccessTime = r2.getAverageValue();
- if(_log.shouldLog(Log.WARN)) {
- _log.warn("No events occurred. Using 1 minute average to look at message delay.");
- }
- }
+ int maxProcessingTime = _context.getProperty(PROP_MAX_PROCESSINGTIME, DEFAULT_MAX_PROCESSINGTIME);
//Set throttling if necessary
- if((avgSendProcessingTime > 800 || currentSendProcessingTime > 1000 || lastSendProcessingTime > 1000)
- && (currentTestSuccessTime > 3000 || lastTestSuccessTime > 3000)) {
+ if((avgSendProcessingTime > maxProcessingTime*0.9
+ || currentSendProcessingTime > maxProcessingTime
+ || lastSendProcessingTime > maxProcessingTime)) {
if(_log.shouldLog(Log.WARN)) {
_log.warn("Refusing tunnel request due to sendProcessingTime of " + avgSendProcessingTime
+ " ms over the last two minutes, which is too much.");