increase the replenish frequency to occur every .1s
logging
This commit is contained in:
@ -35,6 +35,8 @@ public class BandwidthLimitedOutputStream extends FilterOutputStream {
|
||||
_currentRequest = null;
|
||||
}
|
||||
|
||||
public FIFOBandwidthLimiter.Request getCurrentRequest() { return _currentRequest; }
|
||||
|
||||
public void write(int val) throws IOException {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Writing a single byte!", new Exception("Single byte from..."));
|
||||
|
@ -139,8 +139,7 @@ public class FIFOBandwidthLimiter {
|
||||
_log.warn("Still denying the " + _pendingInboundRequests.size()
|
||||
+ " pending inbound requests (available "
|
||||
+ _availableInboundBytes + "/" + _availableOutboundBytes
|
||||
+ " in/out, longest waited " + locked_getLongestInboundWait()
|
||||
+ "/" + locked_getLongestOutboundWait() + " in/out)");
|
||||
+ " in/out, longest waited " + locked_getLongestInboundWait() + " in)");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -169,6 +168,7 @@ public class FIFOBandwidthLimiter {
|
||||
long start = -1;
|
||||
for (int i = 0; i < _pendingOutboundRequests.size(); i++) {
|
||||
SimpleRequest req = (SimpleRequest)_pendingOutboundRequests.get(i);
|
||||
if (req == null) continue;
|
||||
if ( (start < 0) || (start > req.getRequestTime()) )
|
||||
start = req.getRequestTime();
|
||||
}
|
||||
@ -257,8 +257,7 @@ public class FIFOBandwidthLimiter {
|
||||
+ req.getTotalInboundRequested() + " bytes, waited "
|
||||
+ waited
|
||||
+ "ms) pending " + _pendingInboundRequests.size()
|
||||
+ ", longest waited " + locked_getLongestInboundWait()
|
||||
+ "/" + locked_getLongestOutboundWait() + " in/out");
|
||||
+ ", longest waited " + locked_getLongestInboundWait() + " in");
|
||||
} else {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Allocating " + allocated + " bytes inbound to finish the partial grant to "
|
||||
@ -266,8 +265,7 @@ public class FIFOBandwidthLimiter {
|
||||
+ req.getTotalInboundRequested() + " bytes, waited "
|
||||
+ waited
|
||||
+ "ms) pending " + _pendingInboundRequests.size()
|
||||
+ ", longest waited " + locked_getLongestInboundWait()
|
||||
+ "/" + locked_getLongestOutboundWait() + " in/out");
|
||||
+ ", longest waited " + locked_getLongestInboundWait() + " out");
|
||||
_pendingInboundRequests.remove(i);
|
||||
i--;
|
||||
if (waited > 10)
|
||||
@ -291,8 +289,7 @@ public class FIFOBandwidthLimiter {
|
||||
_log.warn("Still denying the " + _pendingOutboundRequests.size()
|
||||
+ " pending outbound requests (available "
|
||||
+ _availableInboundBytes + "/" + _availableOutboundBytes + " in/out, "
|
||||
+ "longest waited " + locked_getLongestInboundWait()
|
||||
+ "/" + locked_getLongestOutboundWait() + " in/out)");
|
||||
+ "longest waited " + locked_getLongestOutboundWait() + " out)");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -326,8 +323,7 @@ public class FIFOBandwidthLimiter {
|
||||
+ req.getTotalOutboundRequested() + " bytes (waited "
|
||||
+ waited
|
||||
+ "ms) pending " + _pendingOutboundRequests.size()
|
||||
+ ", longest waited " + locked_getLongestInboundWait()
|
||||
+ "/" + locked_getLongestOutboundWait() + " in/out");
|
||||
+ ", longest waited " + locked_getLongestOutboundWait() + " out");
|
||||
if (waited > 10)
|
||||
_context.statManager().addRateData("bwLimiter.outboundDelayedTime", waited, waited);
|
||||
}
|
||||
@ -386,8 +382,7 @@ public class FIFOBandwidthLimiter {
|
||||
+ req.getTotalOutboundRequested() + " bytes, waited "
|
||||
+ waited
|
||||
+ "ms) pending " + _pendingOutboundRequests.size()
|
||||
+ ", longest waited " + locked_getLongestInboundWait()
|
||||
+ "/" + locked_getLongestOutboundWait() + " in/out");
|
||||
+ ", longest waited " + locked_getLongestOutboundWait() + " out");
|
||||
} else {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Allocating " + allocated + " bytes outbound to finish the partial grant to "
|
||||
@ -395,8 +390,7 @@ public class FIFOBandwidthLimiter {
|
||||
+ req.getTotalOutboundRequested() + " bytes, waited "
|
||||
+ waited
|
||||
+ "ms) pending " + _pendingOutboundRequests.size()
|
||||
+ ", longest waited " + locked_getLongestInboundWait()
|
||||
+ "/" + locked_getLongestOutboundWait() + " in/out)");
|
||||
+ ", longest waited " + locked_getLongestOutboundWait() + " out)");
|
||||
_pendingOutboundRequests.remove(i);
|
||||
i--;
|
||||
if (waited > 10)
|
||||
|
@ -24,7 +24,7 @@ class FIFOBandwidthRefiller implements Runnable {
|
||||
public static final String PROP_OUTBOUND_BANDWIDTH = "i2np.bandwidth.outboundKBytesPerSecond";
|
||||
public static final String PROP_INBOUND_BANDWIDTH_PEAK = "i2np.bandwidth.inboundBurstKBytes";
|
||||
public static final String PROP_OUTBOUND_BANDWIDTH_PEAK = "i2np.bandwidth.outboundBurstKBytes";
|
||||
public static final String PROP_REPLENISH_FREQUENCY = "i2np.bandwidth.replenishFrequencyMs";
|
||||
//public static final String PROP_REPLENISH_FREQUENCY = "i2np.bandwidth.replenishFrequencyMs";
|
||||
|
||||
/** For now, until there is some tuning and safe throttling, we set the floor at 6KBps inbound */
|
||||
public static final int MIN_INBOUND_BANDWIDTH = 1;
|
||||
@ -35,9 +35,9 @@ class FIFOBandwidthRefiller implements Runnable {
|
||||
/** For now, until there is some tuning and safe throttling, we set the floor at a 10 second burst */
|
||||
public static final int MIN_OUTBOUND_BANDWIDTH_PEAK = 1;
|
||||
/** Updating the bandwidth more than once a second is silly. once every 2 or 5 seconds is less so. */
|
||||
public static final long MIN_REPLENISH_FREQUENCY = 1000;
|
||||
public static final long MIN_REPLENISH_FREQUENCY = 100;
|
||||
|
||||
private static final long DEFAULT_REPLENISH_FREQUENCY = 1*1000;
|
||||
private static final long DEFAULT_REPLENISH_FREQUENCY = 100;
|
||||
|
||||
public FIFOBandwidthRefiller(I2PAppContext context, FIFOBandwidthLimiter limiter) {
|
||||
_limiter = limiter;
|
||||
@ -79,9 +79,9 @@ class FIFOBandwidthRefiller implements Runnable {
|
||||
+ _limiter.getAvailableOutboundBytes()+ ", rate in="
|
||||
+ _inboundKBytesPerSecond + ", out="
|
||||
+ _outboundKBytesPerSecond +")");
|
||||
if (numMs >= 1000) {
|
||||
long inboundToAdd = 1024*_inboundKBytesPerSecond * (numMs/1000);
|
||||
long outboundToAdd = 1024*_outboundKBytesPerSecond * (numMs/1000);
|
||||
if (numMs >= MIN_REPLENISH_FREQUENCY) {
|
||||
long inboundToAdd = (1024*_inboundKBytesPerSecond * numMs)/1000;
|
||||
long outboundToAdd = (1024*_outboundKBytesPerSecond * numMs)/1000;
|
||||
|
||||
if (inboundToAdd < 0) inboundToAdd = 0;
|
||||
if (outboundToAdd < 0) outboundToAdd = 0;
|
||||
@ -118,7 +118,8 @@ class FIFOBandwidthRefiller implements Runnable {
|
||||
updateOutboundRate();
|
||||
updateInboundPeak();
|
||||
updateOutboundPeak();
|
||||
updateReplenishFrequency();
|
||||
|
||||
_replenishFrequency = DEFAULT_REPLENISH_FREQUENCY;
|
||||
|
||||
if (_inboundKBytesPerSecond <= 0) {
|
||||
_limiter.setInboundUnlimited(true);
|
||||
@ -240,27 +241,4 @@ class FIFOBandwidthRefiller implements Runnable {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateReplenishFrequency() {
|
||||
String freqMs = _context.getProperty(PROP_REPLENISH_FREQUENCY);
|
||||
if ( (freqMs != null) &&
|
||||
(freqMs.trim().length() > 0) &&
|
||||
(!(freqMs.equals(String.valueOf(_replenishFrequency)))) ) {
|
||||
// frequency was specified *and* changed
|
||||
try {
|
||||
long ms = Long.parseLong(freqMs);
|
||||
if (ms >= MIN_REPLENISH_FREQUENCY)
|
||||
_replenishFrequency = ms;
|
||||
else
|
||||
_replenishFrequency = MIN_REPLENISH_FREQUENCY;
|
||||
} catch (NumberFormatException nfe) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Invalid replenish frequency [" + freqMs
|
||||
+ "]");
|
||||
}
|
||||
} else {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Replenish frequency not specified in the config via " + PROP_REPLENISH_FREQUENCY);
|
||||
_replenishFrequency = DEFAULT_REPLENISH_FREQUENCY;
|
||||
}
|
||||
}
|
||||
}
|
@ -76,12 +76,12 @@ public abstract class TransportImpl implements Transport {
|
||||
if (lifetime > 5000) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("afterSend: [success=" + sendSuccessful + "]" + msg.getMessageSize() + "byte "
|
||||
+ msg.getMessageType() + " from " + _context.routerHash().toBase64().substring(0,6)
|
||||
+ msg.getMessageType() + " " + msg.getMessageId() + " from " + _context.routerHash().toBase64().substring(0,6)
|
||||
+ " to " + msg.getTarget().getIdentity().calculateHash().toBase64().substring(0,6) + "\n" + msg.toString());
|
||||
} else {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("afterSend: [success=" + sendSuccessful + "]" + msg.getMessageSize() + "byte "
|
||||
+ msg.getMessageType() + " from " + _context.routerHash().toBase64().substring(0,6)
|
||||
+ msg.getMessageType() + " " + msg.getMessageId() + " from " + _context.routerHash().toBase64().substring(0,6)
|
||||
+ " to " + msg.getTarget().getIdentity().calculateHash().toBase64().substring(0,6) + "\n" + msg.toString());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user