I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit ed9a03eb authored by zzz's avatar zzz
Browse files

* Summary bar:

      - Add messages when dropping tunnel requests due to load
parent 619b5c0e
No related branches found
No related tags found
No related merge requests found
...@@ -47,4 +47,5 @@ public interface RouterThrottle { ...@@ -47,4 +47,5 @@ public interface RouterThrottle {
* Message on the state of participating tunnel acceptance * Message on the state of participating tunnel acceptance
*/ */
public String getTunnelStatus(); public String getTunnelStatus();
public void setTunnelStatus(String msg);
} }
...@@ -94,6 +94,7 @@ class RouterThrottleImpl implements RouterThrottle { ...@@ -94,6 +94,7 @@ class RouterThrottleImpl implements RouterThrottle {
return TunnelHistory.TUNNEL_REJECT_CRIT; return TunnelHistory.TUNNEL_REJECT_CRIT;
long lag = _context.jobQueue().getMaxLag(); long lag = _context.jobQueue().getMaxLag();
// 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) if (rs != null)
...@@ -104,7 +105,7 @@ class RouterThrottleImpl implements RouterThrottle { ...@@ -104,7 +105,7 @@ class RouterThrottleImpl implements RouterThrottle {
_log.debug("Refusing tunnel request with the job lag of " + lag _log.debug("Refusing tunnel request with the job lag of " + lag
+ "since the 1 minute message processing time is too slow (" + processTime + ")"); + "since the 1 minute message processing time is too slow (" + processTime + ")");
_context.statManager().addRateData("router.throttleTunnelProcessingTime1m", (long)processTime, (long)processTime); _context.statManager().addRateData("router.throttleTunnelProcessingTime1m", (long)processTime, (long)processTime);
setTunnelStatus("Rejecting tunnels: High processing time"); setTunnelStatus("Rejecting tunnels: High message delay");
return TunnelHistory.TUNNEL_REJECT_TRANSIENT_OVERLOAD; return TunnelHistory.TUNNEL_REJECT_TRANSIENT_OVERLOAD;
} }
...@@ -431,7 +432,7 @@ class RouterThrottleImpl implements RouterThrottle { ...@@ -431,7 +432,7 @@ class RouterThrottleImpl implements RouterThrottle {
setTunnelStatus("Rejecting tunnels"); setTunnelStatus("Rejecting tunnels");
} }
private void setTunnelStatus(String msg) { public void setTunnelStatus(String msg) {
_tunnelStatus = msg; _tunnelStatus = msg;
} }
......
...@@ -103,6 +103,9 @@ class BuildHandler { ...@@ -103,6 +103,9 @@ class BuildHandler {
} }
} while (_inboundBuildMessages.size() > 0); } while (_inboundBuildMessages.size() > 0);
if (dropExpired > 0)
_context.throttle().setTunnelStatus("Dropping tunnel requests: Too slow");
// now pull off the oldest requests first (we're doing a tail-drop // now pull off the oldest requests first (we're doing a tail-drop
// when adding) // when adding)
for (int i = 0; i < toHandle && _inboundBuildMessages.size() > 0; i++) for (int i = 0; i < toHandle && _inboundBuildMessages.size() > 0; i++)
...@@ -310,6 +313,7 @@ class BuildHandler { ...@@ -310,6 +313,7 @@ class BuildHandler {
if (timeSinceReceived > (BuildRequestor.REQUEST_TIMEOUT*3)) { if (timeSinceReceived > (BuildRequestor.REQUEST_TIMEOUT*3)) {
// don't even bother, since we are so overloaded locally // don't even bother, since we are so overloaded locally
_context.throttle().setTunnelStatus("Dropping tunnel requests: Overloaded");
if (_log.shouldLog(Log.WARN)) if (_log.shouldLog(Log.WARN))
_log.warn("Not even trying to handle/decrypt the request " + state.msg.getUniqueId() _log.warn("Not even trying to handle/decrypt the request " + state.msg.getUniqueId()
+ ", since we received it a long time ago: " + timeSinceReceived); + ", since we received it a long time ago: " + timeSinceReceived);
...@@ -464,6 +468,7 @@ class BuildHandler { ...@@ -464,6 +468,7 @@ class BuildHandler {
pDrop = (float)Math.pow(pDrop, 16); pDrop = (float)Math.pow(pDrop, 16);
if (_context.random().nextFloat() < pDrop) { // || (proactiveDrops > MAX_PROACTIVE_DROPS) ) ) { if (_context.random().nextFloat() < pDrop) { // || (proactiveDrops > MAX_PROACTIVE_DROPS) ) ) {
_context.statManager().addRateData("tunnel.rejectOverloaded", recvDelay, proactiveDrops); _context.statManager().addRateData("tunnel.rejectOverloaded", recvDelay, proactiveDrops);
_context.throttle().setTunnelStatus("Rejecting tunnels: Request overload");
if (true || (proactiveDrops < MAX_PROACTIVE_DROPS*2)) if (true || (proactiveDrops < MAX_PROACTIVE_DROPS*2))
response = TunnelHistory.TUNNEL_REJECT_TRANSIENT_OVERLOAD; response = TunnelHistory.TUNNEL_REJECT_TRANSIENT_OVERLOAD;
else else
...@@ -652,6 +657,7 @@ class BuildHandler { ...@@ -652,6 +657,7 @@ class BuildHandler {
} }
} }
if (dropped > 0) { if (dropped > 0) {
_context.throttle().setTunnelStatus("Dropping tunnel requests: High load");
// if the queue is backlogged, stop adding new messages // if the queue is backlogged, stop adding new messages
_context.statManager().addRateData("tunnel.dropLoadBacklog", _inboundBuildMessages.size(), _inboundBuildMessages.size()); _context.statManager().addRateData("tunnel.dropLoadBacklog", _inboundBuildMessages.size(), _inboundBuildMessages.size());
} else { } else {
...@@ -660,6 +666,7 @@ class BuildHandler { ...@@ -660,6 +666,7 @@ class BuildHandler {
pDrop = (float)Math.pow(pDrop, 16); // steeeep pDrop = (float)Math.pow(pDrop, 16); // steeeep
float f = _context.random().nextFloat(); float f = _context.random().nextFloat();
if ( (pDrop > f) && (allowProactiveDrop()) ) { if ( (pDrop > f) && (allowProactiveDrop()) ) {
_context.throttle().setTunnelStatus("Dropping tunnel requests: Queue time");
_context.statManager().addRateData("tunnel.dropLoadProactive", queueTime, _inboundBuildMessages.size()); _context.statManager().addRateData("tunnel.dropLoadProactive", queueTime, _inboundBuildMessages.size());
} else { } else {
_inboundBuildMessages.add(new BuildMessageState(receivedMessage, from, fromHash)); _inboundBuildMessages.add(new BuildMessageState(receivedMessage, from, fromHash));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment