Changeset 68829dd


Ignore:
Timestamp:
Feb 19, 2008 3:16:53 PM (13 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
38c0184f
Parents:
c1703b8 (diff), 19089bd (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge of 'cc7dee6f711dd10db6c1f42af8dc7ba6f6b0002d'

and 'dc2fa2d01da4c7b3733d4dadb85d757d592c1fa6'

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java

    rc1703b8 r68829dd  
    7171
    7272            if (hasTx && hasRx && !_showEvents)
     73                _out.write("<a href=\"viewstat.jsp?stat=bw.combined"
     74                           + "&amp;periodCount=" + (3 * _periodCount )
     75                           + "&amp;width=" + (3 * _width)
     76                           + "&amp;height=" + (3 * _height)
     77                           + "\" />");
    7378                _out.write("<img width=\""
    7479                           + (_width + 83) + "\" height=\"" + (_height + 92)
     
    7782                           + "&amp;width=" + _width
    7883                           + "&amp;height=" + (_height - 14)
    79                            + "\" title=\"Combined bandwidth graph\" />\n");
     84                           + "\" title=\"Combined bandwidth graph\" /></a>\n");
    8085           
    8186            for (Iterator iter = ordered.iterator(); iter.hasNext(); ) {
     
    8388                Rate r = lsnr.getRate();
    8489                String title = r.getRateStat().getName() + " for " + DataHelper.formatDuration(_periodCount * r.getPeriod());
    85                 _out.write("<img width=\""
     90                _out.write("<a href=\"viewstat.jsp?stat="
     91                           + r.getRateStat().getName()
     92                           + "&amp;showEvents=" + _showEvents
     93                           + "&amp;period=" + r.getPeriod()
     94                           + "&amp;periodCount=" + (3 * _periodCount)
     95                           + "&amp;width=" + (3 * _width)
     96                           + "&amp;height=" + (3 * _height)
     97                           + "\" />");
     98                _out.write("<img border=\"0\" width=\""
    8699                           + (_width + 83) + "\" height=\"" + (_height + 92)
    87100                           + "\" src=\"viewstat.jsp?stat="
     
    92105                           + "&amp;width=" + _width
    93106                           + "&amp;height=" + _height
    94                            + "\" title=\"" + title + "\" />\n");
     107                           + "\" title=\"" + title + "\" /></a>\n");
    95108            }
    96109            if (_refreshDelaySeconds > 0)
  • apps/routerconsole/java/src/net/i2p/router/web/UpdateHandler.java

    rc1703b8 r68829dd  
    163163                restart();
    164164            } else {
    165                 _log.log(Log.CRIT, "Update was INVALID - have you changed your keys?");
     165                _log.log(Log.CRIT, "Update was INVALID - signing key is not trusted!");
     166                _status = "<b>Update signing key invalid</b><br />";
    166167                System.setProperty("net.i2p.router.web.UpdateHandler.updateInProgress", "false");
    167168            }
  • checklist.txt

    rc1703b8 r68829dd  
    1212        news.xml
    1313        router/java/src/net/i2p/router/RouterVersion.java
     14        core/java/src/net/i2p/CoreVersion.java
    1415
    1516Build and tag:
  • core/java/src/net/i2p/util/SimpleTimer.java

    rc1703b8 r68829dd  
    208208                } else {
    209209                    _occurredTime = now;
    210                     if (_occurredEventCount > 1000) {
     210                    if (_occurredEventCount > 2500) {
    211211                        StringBuffer buf = new StringBuffer(128);
    212212                        buf.append("Too many simpleTimerJobs (").append(_occurredEventCount);
    213213                        buf.append(") in a second!");
    214                         _log.log(Log.CRIT, buf.toString());
     214                        _log.log(Log.WARN, buf.toString());
    215215                    }
    216216                    _occurredEventCount = 0;
  • history.txt

    rc1703b8 r68829dd  
     12008-02-16 zzz
     2    * Fix race in TunnelDispatcher which caused
     3      participating tunnel count to seesaw -
     4      should increase network capacity
     5    * Leave participating tunnels in 10s batches for efficiency
     6    * Update participating tunnel ratestat when leaving a tunnel too,
     7      to generate a smoother graph
     8    * Fix tunnel.participatingMessageCount stat to include all
     9      participating tunnels, not just outbound endpoints
     10    * Simplify Expire Tunnel job name
     11
     122008-02-13 zzz
     13    * PersistentDataStore: Write out 300 records every 10 min
     14      rather than 1 every 10 sec;
     15      Don't store leasesets to disk or read them in
     16    * Combine rates for pools with the same length setting
     17      in the new tunnel build algorithm
     18    * Clarify a log message in the UpdateHandler
     19
     202008-02-13 zzz
     21    * Make graphs clickable to get larger graphs
     22    * Change SimpleTimer CRIT to a WARN, increase threshold
     23    * Checklist update
     24
    1252008-02-10 zzz
    226    * Add new tunnel build algorithm (preliminary)
  • router/java/src/net/i2p/router/RouterVersion.java

    rc1703b8 r68829dd  
    1818    public final static String ID = "$Revision: 1.548 $ $Date: 2008-02-10 15:00:00 $";
    1919    public final static String VERSION = "0.6.1.31";
    20     public final static long BUILD = 1;
     20    public final static long BUILD = 4;
    2121    public static void main(String args[]) {
    2222        System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
  • router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java

    rc1703b8 r68829dd  
    6767        if ( (data == null) || (key == null) ) return;
    6868        super.put(key, data);
    69         _writer.queue(key, data);
     69        // Don't bother writing LeaseSets to disk
     70        if (data instanceof RouterInfo)
     71            _writer.queue(key, data);
    7072    }
    7173   
     
    104106        public String getName() { return "Remove Key"; }
    105107        public void runJob() {
    106             _log.info("Removing key " + _key, getAddedBy());
     108            _log.info("Removing key " + _key /* , getAddedBy() */);
    107109            try {
    108110                File dbDir = getDbDir();
     
    114116    }
    115117   
     118    /*
     119     * Queue up writes, write up to 300 files every 10 minutes
     120     */
    116121    private class Writer implements Runnable {
    117122        private Map _keys;
     
    138143            Hash key = null;
    139144            DataStructure data = null;
     145            int count = 0;
    140146            while (true) { // hmm, probably want a shutdown handle... though this is a daemon thread
    141147                try {
    142148                    synchronized (_keys) {
    143149                        if (_keyOrder.size() <= 0) {
     150                            count = 0;
    144151                            _keys.wait();
    145152                        } else {
     153                            count++;
    146154                            key = (Hash)_keyOrder.remove(0);
    147155                            data = (DataStructure)_keys.remove(key);
     
    154162                key = null;
    155163                data = null;
    156                 try { Thread.sleep(10*1000); } catch (InterruptedException ie) {}
     164                if (count >= 300)
     165                    count = 0;
     166                if (count == 0)
     167                    try { Thread.sleep(10*60*1000); } catch (InterruptedException ie) {}
    157168            }
    158169        }
     
    228239            try {
    229240                File dbDir = getDbDir();
     241/****
    230242                if (getContext().router().getUptime() < 10*60*1000) {
    231243                    File leaseSetFiles[] = dbDir.listFiles(LeaseSetFilter.getInstance());
     
    238250                    }
    239251                }
     252****/
    240253                File routerInfoFiles[] = dbDir.listFiles(RouterInfoFilter.getInstance());
    241254                if (routerInfoFiles != null) {
     
    260273    }
    261274   
     275/****
    262276    private class ReadLeaseJob extends JobImpl {
    263277        private File _leaseFile;
     
    314328        }
    315329    }
     330****/
    316331   
    317332    private class ReadRouterJob extends JobImpl {
  • router/java/src/net/i2p/router/tunnel/TunnelDispatcher.java

    rc1703b8 r68829dd  
    339339       
    340340        boolean removed = false;
     341        int numParticipants = 0;
    341342        synchronized (_participatingConfig) {
    342343            removed = (null != _participatingConfig.remove(recvId));
     344            numParticipants = _participatingConfig.size();
    343345        }
    344346        if (!removed) {
     
    347349        }
    348350       
     351        _context.statManager().addRateData("tunnel.participatingTunnels", numParticipants, 0);
     352        _context.statManager().addRateData("tunnel.participatingMessageCount", cfg.getProcessedMessagesCount(), 10*60*1000);
     353
    349354        synchronized (_participants) {
    350355            removed = (null != _participants.remove(recvId));
     
    358363            removed = (null != _outboundEndpoints.remove(recvId));
    359364        }
    360        
    361         _context.statManager().addRateData("tunnel.participatingMessageCount", cfg.getProcessedMessagesCount(), 10*60*1000);
    362365    }
    363366   
     
    636639        }
    637640       
     641        private static final int LEAVE_BATCH_TIME = 10*1000;
    638642        public void add(HopConfig cfg) {
    639             Long dropTime = new Long(cfg.getExpiration() + 2*Router.CLOCK_FUDGE_FACTOR);
     643            Long dropTime = new Long(cfg.getExpiration() + 2*Router.CLOCK_FUDGE_FACTOR + LEAVE_BATCH_TIME);
     644            boolean noTunnels;
    640645            synchronized (LeaveTunnel.this) {
     646                noTunnels = _configs.size() <= 0;
    641647                _configs.add(cfg);
    642648                _times.add(dropTime);
    643             }
    644649           
     650                // Make really sure we queue or requeue the job only when we have to, or else bad things happen.
     651                // Locking around this part may not be sufficient but there was nothing before.
     652                // Symptom is the Leave Participant job not running for 12m, leading to seesaw participating tunnel count
     653
     654                long oldAfter = getTiming().getStartAfter();
     655                long oldStart = getTiming().getActualStart();
     656                if ( noTunnels || (oldAfter <= 0) ||
     657                     (oldAfter < getContext().clock().now() && oldAfter <= oldStart) || // if oldAfter > oldStart, it's late but it will run, so don't do this (race)
     658                     (oldAfter >= dropTime.longValue()) ) {
     659                    getTiming().setStartAfter(dropTime.longValue());
     660                    getContext().jobQueue().addJob(LeaveTunnel.this);
     661                } else {
     662                    // already scheduled for the future, and before this expiration
     663                }
     664            }
    645665            if (_log.shouldLog(Log.INFO)) {
    646666                long now = getContext().clock().now();
    647667                _log.info("Scheduling leave in " + DataHelper.formatDuration(dropTime.longValue()-now) +": " + cfg);
    648             }
    649            
    650             long oldAfter = getTiming().getStartAfter();
    651             if ( (oldAfter <= 0) || (oldAfter < getContext().clock().now()) || (oldAfter >= dropTime.longValue()) ) {
    652                 getTiming().setStartAfter(dropTime.longValue());
    653                 getContext().jobQueue().addJob(LeaveTunnel.this);
    654             } else {
    655                 // already scheduled for the future, and before this expiration
    656668            }
    657669        }
     
    661673            HopConfig cur = null;
    662674            Long nextTime = null;
    663             long now = getContext().clock().now();
     675            long now = getContext().clock().now() + LEAVE_BATCH_TIME; // leave all expiring in next 10 sec
    664676            while (true) {
    665677                synchronized (LeaveTunnel.this) {
     
    686698           
    687699            if (nextTime != null) {
    688                 getTiming().setStartAfter(nextTime.longValue());
    689                 getContext().jobQueue().addJob(LeaveTunnel.this);
     700                synchronized (LeaveTunnel.this) {
     701                    getTiming().setStartAfter(nextTime.longValue());
     702                    getContext().jobQueue().addJob(LeaveTunnel.this);
     703                }
    690704            }
    691705        }
  • router/java/src/net/i2p/router/tunnel/pool/ExpireJob.java

    rc1703b8 r68829dd  
    3030    }
    3131    public String getName() {
    32         if (_pool.getSettings().isExploratory()) {
    33             if (_pool.getSettings().isInbound()) {
    34                 return "Expire exploratory inbound tunnel";
    35             } else {
    36                 return "Expire exploratory outbound tunnel";
    37             }
    38         } else {
    39             StringBuffer rv = new StringBuffer(32);
    40             if (_pool.getSettings().isInbound())
    41                 rv.append("Expire inbound client tunnel for ");
    42             else
    43                 rv.append("Expire outbound client tunnel for ");
    44             if (_pool.getSettings().getDestinationNickname() != null)
    45                 rv.append(_pool.getSettings().getDestinationNickname());
    46             else
    47                 rv.append(_pool.getSettings().getDestination().toBase64().substring(0,4));
    48             return rv.toString();
    49         }
     32        return "Expire tunnel";
    5033    }
    5134    public void runJob() {
  • router/java/src/net/i2p/router/tunnel/pool/TunnelPool.java

    rc1703b8 r68829dd  
    4141    private long _lastLifetimeProcessed;
    4242    private final String _rateName;
    43     private final String _buildStatName;
    4443    private static final int TUNNEL_LIFETIME = 10*60*1000;
    4544   
     
    6261                    (_settings.isExploratory() ? "exploratory" : _settings.getDestinationNickname()) +
    6362                    (_settings.isInbound() ? ".in" : ".out");
    64         _buildStatName = "tunnel.build." +
    65                     (_settings.isExploratory() ? "exploratory" : _settings.getDestinationNickname()) +
    66                     (_settings.isInbound() ? ".in" : ".out");
    6763        refreshSettings();
    6864    }
     
    8884                               "Tunnel Bandwidth", "Tunnels",
    8985                               new long[] { 5*60*1000l });
    90         _context.statManager().createRateStat(_buildStatName,
    91                                "Tunnel Build Frequency", "Tunnels",
    92                                new long[] { TUNNEL_LIFETIME });
    9386    }
    9487   
     
    462455   
    463456    /**
     457     * Keep a separate stat for each type, direction, and length of tunnel.
     458     */
     459    private final String buildRateName() {
     460        if (_settings.isExploratory())
     461            return "tunnel.buildRatio.exploratory." + (_settings.isInbound() ? "in" : "out");
     462        else
     463            return "tunnel.buildRatio.l" + _settings.getLength() + "v" + _settings.getLengthVariance() +
     464                    (_settings.isInbound() ? ".in" : ".out");
     465    }
     466
     467    /**
    464468     * Gather the data to see how many tunnels to build, and then actually compute that value (delegated to
    465469     * the countHowManyToBuild function below)
     
    492496         **/
    493497
     498        // Compute the average time it takes us to build a single tunnel of this type.
    494499        int avg = 0;
    495         RateStat rs = _context.statManager().getRate(_buildStatName);
     500        RateStat rs = _context.statManager().getRate(buildRateName());
     501        if (rs == null) {
     502            // Create the RateStat here rather than at the top because
     503            // the user could change the length settings while running
     504            _context.statManager().createRateStat(buildRateName(),
     505                                   "Tunnel Build Frequency", "Tunnels",
     506                                   new long[] { TUNNEL_LIFETIME });
     507            rs = _context.statManager().getRate(buildRateName());
     508        }
    496509        if (rs != null) {
    497510            Rate r = rs.getRate(TUNNEL_LIFETIME);
     
    569582                       + " std " + wanted + " inProgress " + inProgress + " fallback " + fallback
    570583                       + " for " + toString());
    571             _context.statManager().addRateData(_buildStatName, rv + inProgress, 0);
     584            _context.statManager().addRateData(buildRateName(), rv + inProgress, 0);
    572585            return rv;
    573586        }
     
    623636        int rv = countHowManyToBuild(allowZeroHop, expire30s, expire90s, expire150s, expire210s, expire270s,
    624637                                   expireLater, wanted, inProgress, fallback);
    625         _context.statManager().addRateData(_buildStatName, (rv > 0 || inProgress > 0) ? 1 : 0, 0);
     638        _context.statManager().addRateData(buildRateName(), (rv > 0 || inProgress > 0) ? 1 : 0, 0);
    626639        return rv;
    627640
Note: See TracChangeset for help on using the changeset viewer.