net.i2p.router.peermanager
Class CapacityCalculator
java.lang.Object
net.i2p.router.peermanager.Calculator
net.i2p.router.peermanager.CapacityCalculator
public class CapacityCalculator
- extends Calculator
Estimate how many of our tunnels the peer can join per hour.
Pseudocode:
int growthFactor = 5;
int capacity = 0;
foreach i (10, 30, 60) {
if (# tunnels rejected in last $i minutes > 0) continue;
int val = (# tunnels joined in last $i minutes) * (60 / $i);
val -= (# tunnels failed in last $i minutes) * (60 / $i);
if (val >= 0) // if we're failing lots of tunnels, dont grow
capacity += ((val + growthFactor) * periodWeight($i));
}
periodWeight(int curWeight) {
switch (curWeight) {
case 10: return .6;
case 30: return .3;
case 60: return .1;
}
}
Field Summary |
(package private) static long |
GROWTH_FACTOR
used to adjust each period so that we keep trying to expand the peer's capacity |
Method Summary |
double |
calc(PeerProfile profile)
Evaluate the profile according to the current metric |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GROWTH_FACTOR
static long GROWTH_FACTOR
- used to adjust each period so that we keep trying to expand the peer's capacity
CapacityCalculator
public CapacityCalculator(RouterContext context)
calc
public double calc(PeerProfile profile)
- Description copied from class:
Calculator
- Evaluate the profile according to the current metric
- Overrides:
calc
in class Calculator