Changeset fd598de


Ignore:
Timestamp:
May 27, 2009 1:26:51 PM (12 years ago)
Author:
mathiasdm <mathiasdm@…>
Branches:
master
Children:
26c4f98
Parents:
8fef5d9
Message:
  • Increase sendProcessingTime some more, add a property to configure. Configure with 'router.defaultProcessingTimeThrottle'.
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • history.txt

    r8fef5d9 rfd598de  
     12009-05-27 Mathiasdm
     2    * Increase sendProcessingTime some more, add a property to configure.
     3      Configure with 'router.defaultProcessingTimeThrottle'.
     4
    152009-05-27 Mathiasdm
    26    * Increased sendProcessingTime limits and added testSuccessTime
  • router/java/nbproject/project.xml

    r8fef5d9 rfd598de  
    1212            <folders>
    1313                <source-folder>
     14                    <label>i2p_router</label>
     15                    <location>.</location>
     16                    <encoding>UTF-8</encoding>
     17                </source-folder>
     18                <source-folder>
    1419                    <label>src</label>
    1520                    <type>java</type>
     
    2126                    <type>java</type>
    2227                    <location>test</location>
    23                     <encoding>UTF-8</encoding>
    24                 </source-folder>
    25                 <source-folder>
    26                     <label>i2p_router</label>
    27                     <location>.</location>
    2828                    <encoding>UTF-8</encoding>
    2929                </source-folder>
     
    7474                </context-menu>
    7575            </view>
     76            <subprojects/>
    7677        </general-data>
    7778        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
  • router/java/src/net/i2p/router/RouterThrottleImpl.java

    r8fef5d9 rfd598de  
    3434    private static final int DEFAULT_MAX_TUNNELS = 2000;
    3535    private static final String PROP_DEFAULT_KBPS_THROTTLE = "router.defaultKBpsThrottle";
     36    private static final String PROP_MAX_PROCESSINGTIME = "router.defaultProcessingTimeThrottle";
     37    private static final int DEFAULT_MAX_PROCESSINGTIME = 1500;
    3638
    3739    /** tunnel acceptance */
     
    9799
    98100        long lag = _context.jobQueue().getMaxLag();
    99 // reject here if lag too high???
     101        // reject here if lag too high???
     102       
    100103        RateStat rs = _context.statManager().getRate("transport.sendProcessingTime");
    101104        Rate r = null;
    102         if (rs != null)
    103             r = rs.getRate(60*1000);
    104         double processTime = (r != null ? r.getAverageValue() : 0);
    105         if (processTime > 5000) {
    106             if (_log.shouldLog(Log.DEBUG))
    107                 _log.debug("Refusing tunnel request with the job lag of " + lag
    108                            + "since the 1 minute message processing time is too slow (" + processTime + ")");
    109             _context.statManager().addRateData("router.throttleTunnelProcessingTime1m", (long)processTime, (long)processTime);
    110             setTunnelStatus("Rejecting tunnels: High message delay");
    111             return TunnelHistory.TUNNEL_REJECT_TRANSIENT_OVERLOAD;
    112         }
    113105
    114106        //Reject tunnels if the time to process messages and send them is too large. Too much time implies congestion.
    115         Rate r2 = _context.statManager().getRate("tunnel.testSuccessTime").getRate(60*1000);
    116         if(r != null && r2 != null) {
     107        if(r != null) {
    117108            double totalSendProcessingTimeEvents = r.getCurrentEventCount() + r.getLastEventCount();
    118109            double avgSendProcessingTime = 0;
    119110            double currentSendProcessingTime = 0;
    120111            double lastSendProcessingTime = 0;
    121 
    122             double totalTestSuccessTimeEvents = r2.getCurrentEventCount() + r2.getLastEventCount();
    123             double avgTestSuccessTime = 0;
    124             double currentTestSuccessTime = 0;
    125             double lastTestSuccessTime = 0;
    126112           
    127113            //Calculate times
     
    142128            }
    143129
    144             if(r2.getCurrentEventCount() > 0) {
    145                 currentTestSuccessTime = r2.getCurrentTotalValue()/r.getCurrentEventCount();
    146             }
    147             if(r2.getLastEventCount() > 0) {
    148                 lastTestSuccessTime = r2.getLastTotalValue()/r2.getLastEventCount();
    149             }
    150             if(totalTestSuccessTimeEvents > 0) {
    151                 avgTestSuccessTime = (r2.getCurrentTotalValue() + r.getLastTotalValue())/totalTestSuccessTimeEvents;
    152             }
    153             else {
    154                 avgTestSuccessTime = r2.getAverageValue();
    155                 if(_log.shouldLog(Log.WARN)) {
    156                     _log.warn("No events occurred. Using 1 minute average to look at message delay.");
    157                 }
    158             }
     130            int maxProcessingTime = _context.getProperty(PROP_MAX_PROCESSINGTIME, DEFAULT_MAX_PROCESSINGTIME);
    159131
    160132            //Set throttling if necessary
    161             if((avgSendProcessingTime > 800 || currentSendProcessingTime > 1000 || lastSendProcessingTime > 1000)
    162                     && (currentTestSuccessTime > 3000 || lastTestSuccessTime > 3000)) {
     133            if((avgSendProcessingTime > maxProcessingTime*0.9
     134                    || currentSendProcessingTime > maxProcessingTime
     135                    || lastSendProcessingTime > maxProcessingTime)) {
    163136                if(_log.shouldLog(Log.WARN)) {
    164137                    _log.warn("Refusing tunnel request due to sendProcessingTime of " + avgSendProcessingTime
Note: See TracChangeset for help on using the changeset viewer.