Changeset 0428726


Ignore:
Timestamp:
Oct 10, 2008 5:27:23 PM (12 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
d2d32f0
Parents:
2eb154c
Message:
  • Profiles: Reduce reject penalty in capacity calculation to avoid a congestion collapse
File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/peermanager/CapacityCalculator.java

    r2eb154c r0428726  
    101101        if (curAccepted != null)
    102102            eventCount = curAccepted.getCurrentEventCount() + curAccepted.getLastEventCount();
     103        // Punish for rejections.
     104        // We don't want to simply do eventCount -= rejected or we get to zero with 50% rejection,
     105        // and we don't want everybody to be at zero during times of congestion.
     106        if (eventCount > 0) {
     107            long rejected = curRejected.getCurrentEventCount() + curRejected.getLastEventCount();
     108            eventCount = eventCount * eventCount / (eventCount + rejected);
     109        }
    103110        double stretch = ((double)ESTIMATE_PERIOD) / period;
    104111        double val = eventCount * stretch;
     
    116123            val -= failed * stretch;
    117124        }
    118        
    119         //if ( (period <= 10*60*1000) && (curRejected.getCurrentEventCount() + curRejected.getLastEventCount() > 0) ) {
    120         //    //System.out.println("10m period has rejected " + (curRejected.getCurrentEventCount() + curRejected.getLastEventCount()) + " times");
    121         //    return 0.0d;
    122         //} else
    123             val -= stretch * (curRejected.getCurrentEventCount() + curRejected.getLastEventCount());
    124125       
    125126        val += GROWTH_FACTOR;
Note: See TracChangeset for help on using the changeset viewer.