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

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

* Profiles: Reduce reject penalty in

      capacity calculation to avoid a congestion collapse
parent 2eb154c2
No related branches found
No related tags found
No related merge requests found
...@@ -100,6 +100,13 @@ public class CapacityCalculator extends Calculator { ...@@ -100,6 +100,13 @@ public class CapacityCalculator extends Calculator {
long eventCount = 0; long eventCount = 0;
if (curAccepted != null) if (curAccepted != null)
eventCount = curAccepted.getCurrentEventCount() + curAccepted.getLastEventCount(); eventCount = curAccepted.getCurrentEventCount() + curAccepted.getLastEventCount();
// Punish for rejections.
// We don't want to simply do eventCount -= rejected or we get to zero with 50% rejection,
// and we don't want everybody to be at zero during times of congestion.
if (eventCount > 0) {
long rejected = curRejected.getCurrentEventCount() + curRejected.getLastEventCount();
eventCount = eventCount * eventCount / (eventCount + rejected);
}
double stretch = ((double)ESTIMATE_PERIOD) / period; double stretch = ((double)ESTIMATE_PERIOD) / period;
double val = eventCount * stretch; double val = eventCount * stretch;
long failed = 0; long failed = 0;
...@@ -116,12 +123,6 @@ public class CapacityCalculator extends Calculator { ...@@ -116,12 +123,6 @@ public class CapacityCalculator extends Calculator {
val -= failed * stretch; val -= failed * stretch;
} }
//if ( (period <= 10*60*1000) && (curRejected.getCurrentEventCount() + curRejected.getLastEventCount() > 0) ) {
// //System.out.println("10m period has rejected " + (curRejected.getCurrentEventCount() + curRejected.getLastEventCount()) + " times");
// return 0.0d;
//} else
val -= stretch * (curRejected.getCurrentEventCount() + curRejected.getLastEventCount());
val += GROWTH_FACTOR; val += GROWTH_FACTOR;
if (val >= 0) { if (val >= 0) {
......
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