forked from I2P_Developers/i2p.i2p
* Increase sendProcessingTime some more, add a property to configure.
Configure with 'router.defaultProcessingTimeThrottle'.
This commit is contained in:
@ -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
|
2009-05-27 Mathiasdm
|
||||||
* Increased sendProcessingTime limits and added testSuccessTime
|
* Increased sendProcessingTime limits and added testSuccessTime
|
||||||
to avoid unwanted throttling
|
to avoid unwanted throttling
|
||||||
|
@ -10,6 +10,11 @@
|
|||||||
<name>i2p_router</name>
|
<name>i2p_router</name>
|
||||||
<properties/>
|
<properties/>
|
||||||
<folders>
|
<folders>
|
||||||
|
<source-folder>
|
||||||
|
<label>i2p_router</label>
|
||||||
|
<location>.</location>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
</source-folder>
|
||||||
<source-folder>
|
<source-folder>
|
||||||
<label>src</label>
|
<label>src</label>
|
||||||
<type>java</type>
|
<type>java</type>
|
||||||
@ -22,11 +27,6 @@
|
|||||||
<location>test</location>
|
<location>test</location>
|
||||||
<encoding>UTF-8</encoding>
|
<encoding>UTF-8</encoding>
|
||||||
</source-folder>
|
</source-folder>
|
||||||
<source-folder>
|
|
||||||
<label>i2p_router</label>
|
|
||||||
<location>.</location>
|
|
||||||
<encoding>UTF-8</encoding>
|
|
||||||
</source-folder>
|
|
||||||
</folders>
|
</folders>
|
||||||
<ide-actions>
|
<ide-actions>
|
||||||
<action name="build">
|
<action name="build">
|
||||||
@ -73,6 +73,7 @@
|
|||||||
<ide-action name="test"/>
|
<ide-action name="test"/>
|
||||||
</context-menu>
|
</context-menu>
|
||||||
</view>
|
</view>
|
||||||
|
<subprojects/>
|
||||||
</general-data>
|
</general-data>
|
||||||
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
|
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
|
||||||
<compilation-unit>
|
<compilation-unit>
|
||||||
|
@ -33,6 +33,8 @@ class RouterThrottleImpl implements RouterThrottle {
|
|||||||
private static final String PROP_MAX_TUNNELS = "router.maxParticipatingTunnels";
|
private static final String PROP_MAX_TUNNELS = "router.maxParticipatingTunnels";
|
||||||
private static final int DEFAULT_MAX_TUNNELS = 2000;
|
private static final int DEFAULT_MAX_TUNNELS = 2000;
|
||||||
private static final String PROP_DEFAULT_KBPS_THROTTLE = "router.defaultKBpsThrottle";
|
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 */
|
/** tunnel acceptance */
|
||||||
public static final int TUNNEL_ACCEPT = 0;
|
public static final int TUNNEL_ACCEPT = 0;
|
||||||
@ -96,34 +98,18 @@ class RouterThrottleImpl implements RouterThrottle {
|
|||||||
return TunnelHistory.TUNNEL_REJECT_BANDWIDTH;
|
return TunnelHistory.TUNNEL_REJECT_BANDWIDTH;
|
||||||
|
|
||||||
long lag = _context.jobQueue().getMaxLag();
|
long lag = _context.jobQueue().getMaxLag();
|
||||||
// reject here if lag too high???
|
// reject here if lag too high???
|
||||||
|
|
||||||
RateStat rs = _context.statManager().getRate("transport.sendProcessingTime");
|
RateStat rs = _context.statManager().getRate("transport.sendProcessingTime");
|
||||||
Rate r = null;
|
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.
|
//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) {
|
||||||
if(r != null && r2 != null) {
|
|
||||||
double totalSendProcessingTimeEvents = r.getCurrentEventCount() + r.getLastEventCount();
|
double totalSendProcessingTimeEvents = r.getCurrentEventCount() + r.getLastEventCount();
|
||||||
double avgSendProcessingTime = 0;
|
double avgSendProcessingTime = 0;
|
||||||
double currentSendProcessingTime = 0;
|
double currentSendProcessingTime = 0;
|
||||||
double lastSendProcessingTime = 0;
|
double lastSendProcessingTime = 0;
|
||||||
|
|
||||||
double totalTestSuccessTimeEvents = r2.getCurrentEventCount() + r2.getLastEventCount();
|
|
||||||
double avgTestSuccessTime = 0;
|
|
||||||
double currentTestSuccessTime = 0;
|
|
||||||
double lastTestSuccessTime = 0;
|
|
||||||
|
|
||||||
//Calculate times
|
//Calculate times
|
||||||
if(r.getCurrentEventCount() > 0) {
|
if(r.getCurrentEventCount() > 0) {
|
||||||
currentSendProcessingTime = r.getCurrentTotalValue()/r.getCurrentEventCount();
|
currentSendProcessingTime = r.getCurrentTotalValue()/r.getCurrentEventCount();
|
||||||
@ -141,25 +127,12 @@ class RouterThrottleImpl implements RouterThrottle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(r2.getCurrentEventCount() > 0) {
|
int maxProcessingTime = _context.getProperty(PROP_MAX_PROCESSINGTIME, DEFAULT_MAX_PROCESSINGTIME);
|
||||||
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.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Set throttling if necessary
|
//Set throttling if necessary
|
||||||
if((avgSendProcessingTime > 800 || currentSendProcessingTime > 1000 || lastSendProcessingTime > 1000)
|
if((avgSendProcessingTime > maxProcessingTime*0.9
|
||||||
&& (currentTestSuccessTime > 3000 || lastTestSuccessTime > 3000)) {
|
|| currentSendProcessingTime > maxProcessingTime
|
||||||
|
|| lastSendProcessingTime > maxProcessingTime)) {
|
||||||
if(_log.shouldLog(Log.WARN)) {
|
if(_log.shouldLog(Log.WARN)) {
|
||||||
_log.warn("Refusing tunnel request due to sendProcessingTime of " + avgSendProcessingTime
|
_log.warn("Refusing tunnel request due to sendProcessingTime of " + avgSendProcessingTime
|
||||||
+ " ms over the last two minutes, which is too much.");
|
+ " ms over the last two minutes, which is too much.");
|
||||||
|
Reference in New Issue
Block a user