Changeset c356792


Ignore:
Timestamp:
May 6, 2011 1:10:28 AM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
5ce06d02
Parents:
90642a8a
Message:
  • Tunnels and profiles:
    • Increase max fast and high-cap tier sizes
    • Slow profile eval cycle after sufficient uptime
    • Fix bug which started a new build after a successful build
    • Misc. cleanups
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • history.txt

    r90642a8a rc356792  
     12011-05-06 zzz
     2    * Tunnels and profiles:
     3      - Increase max fast and high-cap tier sizes
     4      - Slow profile eval cycle after sufficient uptime
     5      - Fix bug which started a new build after a successful build
     6      - Misc. cleanups
     7
    182011-04-28 zzz
    29    * Console: Try to prevent cascaded IllegalStateExceptions in .jsp code;
  • router/java/src/net/i2p/router/RouterVersion.java

    r90642a8a rc356792  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 1;
     21    public final static long BUILD = 2;
    2222
    2323    /** for example "-test" */
  • router/java/src/net/i2p/router/TunnelPoolSettings.java

    r90642a8a rc356792  
    1717    private int _backupQuantity;
    1818    // private int _rebuildPeriod;
    19     private int _duration;
     19    //private int _duration;
    2020    private int _length;
    2121    private int _lengthVariance;
     
    2525    private boolean _allowZeroHop;
    2626    private int _IPRestriction;
    27     private Properties _unknownOptions;
    28     private Hash _randomKey;
     27    private final Properties _unknownOptions;
     28    private final Hash _randomKey;
    2929   
    3030    /** prefix used to override the router's defaults for clients */
     
    5858        _backupQuantity = DEFAULT_BACKUP_QUANTITY;
    5959        // _rebuildPeriod = DEFAULT_REBUILD_PERIOD;
    60         _duration = DEFAULT_DURATION;
     60        //_duration = DEFAULT_DURATION;
    6161        _length = DEFAULT_LENGTH;
    6262        _lengthVariance = DEFAULT_LENGTH_VARIANCE;
     
    108108    public void setIsExploratory(boolean isExploratory) { _isExploratory = isExploratory; }
    109109   
    110     public int getDuration() { return _duration; }
    111     public void setDuration(int ms) { _duration = ms; }
     110    // Duration is hardcoded
     111    //public int getDuration() { return _duration; }
     112    //public void setDuration(int ms) { _duration = ms; }
    112113   
    113114    /** what destination is this a tunnel for (or null if none) */
     
    142143                else if (name.equalsIgnoreCase(prefix + PROP_BACKUP_QUANTITY))
    143144                    _backupQuantity = getInt(value, DEFAULT_BACKUP_QUANTITY);
    144                 else if (name.equalsIgnoreCase(prefix + PROP_DURATION))
    145                     _duration = getInt(value, DEFAULT_DURATION);
     145                //else if (name.equalsIgnoreCase(prefix + PROP_DURATION))
     146                //    _duration = getInt(value, DEFAULT_DURATION);
    146147                else if (name.equalsIgnoreCase(prefix + PROP_LENGTH))
    147148                    _length = getInt(value, DEFAULT_LENGTH);
     
    166167        props.setProperty(prefix + PROP_ALLOW_ZERO_HOP, ""+_allowZeroHop);
    167168        props.setProperty(prefix + PROP_BACKUP_QUANTITY, ""+_backupQuantity);
    168         props.setProperty(prefix + PROP_DURATION, ""+_duration);
     169        //props.setProperty(prefix + PROP_DURATION, ""+_duration);
    169170        props.setProperty(prefix + PROP_LENGTH, ""+_length);
    170171        props.setProperty(prefix + PROP_LENGTH_VARIANCE, ""+_lengthVariance);
  • router/java/src/net/i2p/router/peermanager/DBHistory.java

    r90642a8a rc356792  
    1414 */
    1515public class DBHistory {
    16     private Log _log;
    17     private RouterContext _context;
     16    private final Log _log;
     17    private final RouterContext _context;
    1818    private long _successfulLookups;
    1919    private long _failedLookups;
     
    3333    private long _unpromptedDbStoreNew;
    3434    private long _unpromptedDbStoreOld;
    35     private String _statGroup;
     35    private final String _statGroup;
    3636   
    3737    public DBHistory(RouterContext context, String statGroup) {
     
    3939        _log = context.logManager().getLog(DBHistory.class);
    4040        _statGroup = statGroup;
    41         _successfulLookups = 0;
    42         _failedLookups = 0;
    43         _failedLookupRate = null;
    44         _invalidReplyRate = null;
    45         _lookupReplyNew = 0;
    46         _lookupReplyOld = 0;
    47         _lookupReplyDuplicate = 0;
    48         _lookupReplyInvalid = 0;
    49         _lookupsReceived = 0;
    50         _avgDelayBetweenLookupsReceived = 0;
    5141        _lastLookupReceived = -1;
    52         _unpromptedDbStoreNew = 0;
    53         _unpromptedDbStoreOld = 0;
    5442        createRates(statGroup);
    5543    }
  • router/java/src/net/i2p/router/peermanager/PeerManager.java

    r90642a8a rc356792  
    2424import net.i2p.router.RouterContext;
    2525import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade;
     26import net.i2p.util.ConcurrentHashSet;
    2627import net.i2p.util.Log;
    27 import net.i2p.util.SimpleScheduler;
    28 import net.i2p.util.SimpleTimer;
    29 import net.i2p.util.ConcurrentHashSet;
     28import net.i2p.util.SimpleTimer2;
    3029
    3130/**
     
    4443 */
    4544class PeerManager {
    46     private Log _log;
    47     private RouterContext _context;
    48     private ProfileOrganizer _organizer;
    49     private ProfilePersistenceHelper _persistenceHelper;
    50     private Set<Hash> _peersByCapability[];
     45    private final Log _log;
     46    private final RouterContext _context;
     47    private final ProfileOrganizer _organizer;
     48    private final ProfilePersistenceHelper _persistenceHelper;
     49    private final Set<Hash> _peersByCapability[];
    5150    private final Map<Hash, String> _capabilitiesByPeer;
     51    private static final long REORGANIZE_TIME = 45*1000;
     52    private static final long REORGANIZE_TIME_MEDIUM = 123*1000;
     53    private static final long REORGANIZE_TIME_LONG = 551*1000;
    5254   
    5355    public PeerManager(RouterContext context) {
     
    6365        loadProfiles();
    6466        ////_context.jobQueue().addJob(new EvaluateProfilesJob(_context));
    65         SimpleScheduler.getInstance().addPeriodicEvent(new Reorg(), 0, 45*1000);
     67        //SimpleScheduler.getInstance().addPeriodicEvent(new Reorg(), 0, REORGANIZE_TIME);
     68        new Reorg();
    6669        //_context.jobQueue().addJob(new PersistProfilesJob(_context, this));
    6770    }
    6871   
    69     private class Reorg implements SimpleTimer.TimedEvent {
     72    private class Reorg extends SimpleTimer2.TimedEvent {
     73        public Reorg() {
     74            super(SimpleTimer2.getInstance(), REORGANIZE_TIME);
     75        }
    7076        public void timeReached() {
    7177            try {
     
    7480                _log.log(Log.CRIT, "Error evaluating profiles", t);
    7581            }
     82            long uptime = _context.router().getUptime();
     83            long delay;
     84            if (uptime > 2*60*60*1000)
     85                delay = REORGANIZE_TIME_LONG;
     86            else if (uptime > 10*60*1000)
     87                delay = REORGANIZE_TIME_MEDIUM;
     88            else
     89                delay = REORGANIZE_TIME;
     90            schedule(delay);
    7691        }
    7792    }
  • router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java

    r90642a8a rc356792  
    4141 */
    4242public class ProfileOrganizer {
    43     private Log _log;
    44     private RouterContext _context;
     43    private final Log _log;
     44    private final RouterContext _context;
    4545    /** H(routerIdentity) to PeerProfile for all peers that are fast and high capacity*/
    46     private Map<Hash, PeerProfile> _fastPeers;
     46    private final Map<Hash, PeerProfile> _fastPeers;
    4747    /** H(routerIdentity) to PeerProfile for all peers that have high capacities */
    48     private Map<Hash, PeerProfile> _highCapacityPeers;
     48    private final Map<Hash, PeerProfile> _highCapacityPeers;
    4949    /** H(routerIdentity) to PeerProfile for all peers that well integrated into the network and not failing horribly */
    50     private Map<Hash, PeerProfile> _wellIntegratedPeers;
     50    private final Map<Hash, PeerProfile> _wellIntegratedPeers;
    5151    /** H(routerIdentity) to PeerProfile for all peers that are not failing horribly */
    52     private Map<Hash, PeerProfile> _notFailingPeers;
     52    private final Map<Hash, PeerProfile> _notFailingPeers;
    5353    /** H(routerIdnetity), containing elements in _notFailingPeers */
    54     private List<Hash> _notFailingPeersList;
     54    private final List<Hash> _notFailingPeersList;
    5555    /** H(routerIdentity) to PeerProfile for all peers that ARE failing horribly (but that we haven't dropped reference to yet) */
    56     private Map<Hash, PeerProfile> _failingPeers;
     56    private final Map<Hash, PeerProfile> _failingPeers;
    5757    /** who are we? */
    5858    private Hash _us;
    59     private ProfilePersistenceHelper _persistenceHelper;
     59    private final ProfilePersistenceHelper _persistenceHelper;
    6060   
    6161    /** PeerProfile objects for all peers profiled, orderd by the ones with the highest capacity first */
     
    6969    private double _thresholdIntegrationValue;
    7070   
    71     private InverseCapacityComparator _comp;
     71    private final InverseCapacityComparator _comp;
    7272
    7373    /**
     
    8080    /** this is misnamed, it is really the max minimum number. */
    8181    private static final int DEFAULT_MAXIMUM_FAST_PEERS = 16;
     82    private static final int ABSOLUTE_MAX_FAST_PEERS = 60;
     83
    8284    /**
    8385     * Defines the minimum number of 'high capacity' peers that the organizer should
     
    8890    public static final String PROP_MINIMUM_HIGH_CAPACITY_PEERS = "profileOrganizer.minHighCapacityPeers";
    8991    public static final int DEFAULT_MINIMUM_HIGH_CAPACITY_PEERS = 10;
     92    private static final int ABSOLUTE_MAX_HIGHCAP_PEERS = 150;
    9093   
    9194    /** synchronized against this lock when updating the tier that peers are located in (and when fetching them from a peer) */
     
    277280     * @param exclude set of Hashes for routers that we don't want selected
    278281     * @param matches set to store the return value in
     282     * @param mask 0-4 Number of bytes to match to determine if peers in the same IP range should
     283     *             not be in the same tunnel. 0 = disable check; 1 = /8; 2 = /16; 3 = /24; 4 = exact IP match
    279284     *
    280285     */
     
    282287        selectFastPeers(howMany, exclude, matches, 0);
    283288    }
     289
    284290    public void selectFastPeers(int howMany, Set<Hash> exclude, Set<Hash> matches, int mask) {
    285291        getReadLock();
     
    305311        selectHighCapacityPeers(howMany, exclude, matches, 0);
    306312    }
     313
     314    /**
     315     * @param mask 0-4 Number of bytes to match to determine if peers in the same IP range should
     316     *             not be in the same tunnel. 0 = disable check; 1 = /8; 2 = /16; 3 = /24; 4 = exact IP match
     317     */
    307318    public void selectHighCapacityPeers(int howMany, Set<Hash> exclude, Set<Hash> matches, int mask) {
    308319        getReadLock();
     
    329340        return;
    330341    }
     342
    331343    /**
    332344     * Return a set of Hashes for peers that are well integrated into the network.
    333345     *
     346     * @param mask 0-4 Number of bytes to match to determine if peers in the same IP range should
     347     *             not be in the same tunnel. 0 = disable check; 1 = /8; 2 = /16; 3 = /24; 4 = exact IP match
    334348     */
    335349    public void selectWellIntegratedPeers(int howMany, Set<Hash> exclude, Set<Hash> matches) {
    336350        selectWellIntegratedPeers(howMany, exclude, matches, 0);
    337351    }
     352
    338353    public void selectWellIntegratedPeers(int howMany, Set<Hash> exclude, Set<Hash> matches, int mask) {
    339354        getReadLock();
     
    352367        return;
    353368    }
     369
    354370    /**
    355371     * Return a set of Hashes for peers that are not failing, preferring ones that
     
    360376        selectNotFailingPeers(howMany, exclude, matches, false, 0);
    361377    }
     378
     379    /**
     380     * @param mask ignored, should call locked_selectPeers, to be fixed
     381     */
    362382    public void selectNotFailingPeers(int howMany, Set<Hash> exclude, Set<Hash> matches, int mask) {
    363383        selectNotFailingPeers(howMany, exclude, matches, false, mask);
    364384    }
     385
    365386    public void selectNotFailingPeers(int howMany, Set<Hash> exclude, Set<Hash> matches, boolean onlyNotFailing) {
    366387        selectNotFailingPeers(howMany, exclude, matches, onlyNotFailing, 0);
    367388    }
     389
    368390    /**
    369391     * Return a set of Hashes for peers that are not failing, preferring ones that
     
    374396     * @param matches set to store the matches in
    375397     * @param onlyNotFailing if true, don't include any high capacity peers
     398     * @param mask ignored, should call locked_selectPeers, to be fixed
    376399     */
    377400    public void selectNotFailingPeers(int howMany, Set<Hash> exclude, Set<Hash> matches, boolean onlyNotFailing, int mask) {
     
    418441     *
    419442     * This DOES cascade further to non-connected peers.
     443     *
     444     * @param mask 0-4 Number of bytes to match to determine if peers in the same IP range should
     445     *             not be in the same tunnel. 0 = disable check; 1 = /8; 2 = /16; 3 = /24; 4 = exact IP match
    420446     */
    421447    private void selectActiveNotFailingPeers2(int howMany, Set<Hash> exclude, Set<Hash> matches, int mask) {
     
    449475        selectAllNotFailingPeers(howMany, exclude, matches, onlyNotFailing, 0);
    450476    }
     477
    451478    /**
    452479     * @param mask ignored, should call locked_selectPeers, to be fixed
     
    498525        return;
    499526    }
     527
    500528    /**
    501529     * I'm not quite sure why you'd want this... (other than for failover from the better results)
     
    615643     */
    616644    public void reorganize() { reorganize(false); }
     645
    617646    public void reorganize(boolean shouldCoalesce) {
    618647        long sortTime = 0;
     
    10511080    }
    10521081
     1082    /**
     1083     * @param mask 0-4 Number of bytes to match to determine if peers in the same IP range should
     1084     *             not be in the same tunnel. 0 = disable check; 1 = /8; 2 = /16; 3 = /24; 4 = exact IP match
     1085     */
    10531086    private void locked_selectPeers(Map<Hash, PeerProfile> peers, int howMany, Set<Hash> toExclude, Set<Hash> matches, int mask) {
    10541087        List<Hash> all = new ArrayList(peers.keySet());
     
    12621295    /** fixme add config  @since 0.7.10 */
    12631296    protected int getMaximumFastPeers() {
    1264         return 30;
     1297        return ABSOLUTE_MAX_FAST_PEERS;
    12651298    }
    12661299   
    12671300    /** fixme add config  @since 0.7.11 */
    12681301    protected int getMaximumHighCapPeers() {
    1269         return 75;
     1302        return ABSOLUTE_MAX_HIGHCAP_PEERS;
    12701303    }
    12711304   
  • router/java/src/net/i2p/router/peermanager/TunnelHistory.java

    r90642a8a rc356792  
    1515 */
    1616public class TunnelHistory {
    17     private RouterContext _context;
    18     private Log _log;
     17    private final RouterContext _context;
     18    private final Log _log;
    1919    private volatile long _lifetimeAgreedTo;
    2020    private volatile long _lifetimeRejected;
     
    2828    private RateStat _rejectRate;
    2929    private RateStat _failRate;
    30     private String _statGroup;
     30    private final String _statGroup;
    3131   
    3232    /** probabalistic tunnel rejection due to a flood of requests - essentially unused */
  • router/java/src/net/i2p/router/tunnel/pool/BuildExecutor.java

    r90642a8a rc356792  
    456456    }
    457457   
     458    /**
     459     *  This wakes up the executor, so call this after TunnelPool.addTunnel()
     460     *  so we don't build too many.
     461     */
    458462    public void buildComplete(PooledTunnelCreatorConfig cfg, TunnelPool pool) {
    459463        if (_log.shouldLog(Log.DEBUG))
  • router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java

    r90642a8a rc356792  
    224224                }
    225225            }
    226             _exec.buildComplete(cfg, cfg.getTunnelPool());
     226
    227227            if (allAgree) {
    228228                // wikked, completely build
     
    232232                    _context.tunnelDispatcher().joinOutbound(cfg);
    233233                cfg.getTunnelPool().addTunnel(cfg); // self.self.self.foo!
     234                // call buildComplete() after addTunnel() so we don't try another build.
     235                _exec.buildComplete(cfg, cfg.getTunnelPool());
    234236                _exec.buildSuccessful(cfg);
    235237               
     
    243245            } else {
    244246                // someone is no fun
     247                _exec.buildComplete(cfg, cfg.getTunnelPool());
    245248                if (cfg.getDestination() == null)
    246249                    _context.statManager().addRateData("tunnel.buildExploratoryReject", rtt, rtt);
  • router/java/src/net/i2p/router/tunnel/pool/TunnelPeerSelector.java

    r90642a8a rc356792  
    3535     *
    3636     * @return ordered list of Hash objects (one per peer) specifying what order
    37      *         they should appear in a tunnel (endpoint first).  This includes
     37     *         they should appear in a tunnel (ENDPOINT FIRST).  This includes
    3838     *         the local router in the list.  If there are no tunnels or peers
    3939     *         to build through, and the settings reject 0 hop tunnels, this will
     
    6262        if (length < 0)
    6363            length = 0;
    64         if (length > 8) // as documented in tunnel.html
     64        else if (length > 8) // as documented in tunnel.html
    6565            length = 8;
    6666        /*
  • router/java/src/net/i2p/router/tunnel/pool/TunnelPoolManager.java

    r90642a8a rc356792  
    330330    /** queue a recurring test job if appropriate */
    331331    void buildComplete(PooledTunnelCreatorConfig cfg) {
    332         //buildComplete();
    333332        if (cfg.getLength() > 1 &&
    334333            (!_context.router().gracefulShutdownInProgress()) &&
     
    358357    }
    359358
    360     /** ?? */
    361     void buildComplete() {}
    362    
    363359    public void startup() {
    364360        _isShutdown = false;
Note: See TracChangeset for help on using the changeset viewer.