Changeset a9e8fc2


Ignore:
Timestamp:
Jul 20, 2009 12:02:34 AM (11 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
99f8468f
Parents:
e225244
Message:
  • Peer Profiles:
    • Reduce max age for display to 2h (was 3h)
    • Drop unused Persist classes
    • Dynamically adjust expire time to control memory use
Location:
router/java/src/net/i2p/router/peermanager
Files:
2 deleted
2 edited

Legend:

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

    re225244 ra9e8fc2  
    598598    }
    599599   
     600    private static final long MIN_EXPIRE_TIME = 3*60*60*1000;
     601    private static final long MAX_EXPIRE_TIME = 6*60*60*1000;
     602    private static final long ADJUST_EXPIRE_TIME = 60*1000;
     603    private static final int ENOUGH_PROFILES = 600;
     604    private long _currentExpireTime = MAX_EXPIRE_TIME;
     605
    600606    /**
    601607     * Place peers into the correct tier, as well as expand/contract and even drop profiles
     
    615621        long expireOlderThan = -1;
    616622        if (uptime > 60*60*1000) {
    617             // drop profiles that we haven't spoken with in 6 hours
    618             expireOlderThan = _context.clock().now() - 6*60*60*1000;
     623            // dynamically adjust expire time to control memory usage
     624            if (countNotFailingPeers() > ENOUGH_PROFILES)
     625                _currentExpireTime = Math.max(_currentExpireTime - ADJUST_EXPIRE_TIME, MIN_EXPIRE_TIME);
     626            else
     627                _currentExpireTime = Math.min(_currentExpireTime + ADJUST_EXPIRE_TIME, MAX_EXPIRE_TIME);
     628            // drop profiles that we haven't spoken to in a while
     629            expireOlderThan = _context.clock().now() - _currentExpireTime;
    619630        }
    620631           
  • router/java/src/net/i2p/router/peermanager/ProfileOrganizerRenderer.java

    re225244 ra9e8fc2  
    3434       
    3535        long now = _context.clock().now();
    36         long hideBefore = now - 3*60*60*1000;
     36        long hideBefore = now - 2*60*60*1000;
    3737       
    3838        TreeSet order = new TreeSet(_comparator);
     
    223223        buf.append("<li><b>failing?</b>: is the peer currently swamped (and if possible we should avoid nagging them)?</li>");
    224224        buf.append("</ul></i>");
    225         buf.append("Red peers prefixed with '--' means the peer is failing, and blue peers prefixed ");
    226         buf.append("with '++' means we've sent or received a message from them ");
    227         buf.append("in the last five minutes.</i><br />");
    228225        buf.append("<p><b>Thresholds:</b><br />");
    229226        buf.append("<b>Speed:</b> ").append(num(_organizer.getSpeedThreshold())).append(" (").append(fast).append(" fast peers)<br />");
Note: See TracChangeset for help on using the changeset viewer.