Changeset 2552d99


Ignore:
Timestamp:
Aug 25, 2012 2:48:39 PM (7 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
ba99206
Parents:
e99e25b
Message:
  • Other object churn cleanups (ticket #699)
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • history.txt

    re99e25b r2552d99  
     12012-08-25 zzz
     2 * SDSCache: Reduce min and increase max size
     3 * SimpleByteCache: Change from LBQ to ABQ to reduce object churn
     4 * Other object churn cleanups (ticket #699)
     5
    162012-08-24 zzz
    27 * I2CP:
  • router/java/src/net/i2p/router/RouterVersion.java

    re99e25b r2552d99  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 17;
     21    public final static long BUILD = 18;
    2222
    2323    /** for example "-test" */
  • router/java/src/net/i2p/router/networkdb/kademlia/KBucket.java

    re99e25b r2552d99  
    5858     */
    5959    public Set<Hash> getEntries();
     60
    6061    /**
    6162     * Retrieve hashes stored in the bucket, excluding the ones specified
    6263     * @return set of Hash structures
     64     * @deprecated makes a copy, remove toIgnore in KBS instead
    6365     */
    6466    public Set<Hash> getEntries(Set<Hash> toIgnoreHashes);
     67
    6568    public void getEntries(SelectionCollector collector);
    6669   
  • router/java/src/net/i2p/router/networkdb/kademlia/KBucketImpl.java

    re99e25b r2552d99  
    1010
    1111import java.math.BigInteger;
     12import java.util.Collections;
    1213import java.util.HashSet;
    1314import java.util.Set;
     
    209210    }
    210211   
     212    /**
     213     *  @return unmodifiable view
     214     */
    211215    public Set<Hash> getEntries() {
    212         Set<Hash> entries = new HashSet(_entries);
    213         return entries;
    214     }
     216        return Collections.unmodifiableSet(_entries);
     217    }
     218
     219    /**
     220     *  @deprecated makes a copy, remove toIgnore in KBS instead
     221     */
    215222    public Set<Hash> getEntries(Set toIgnoreHashes) {
    216223        Set<Hash> entries = new HashSet(_entries);
     
    220227   
    221228    public void getEntries(SelectionCollector collector) {
    222         Set<Hash> entries = new HashSet(_entries);
    223         for (Hash h : entries) {
     229        for (Hash h : _entries) {
    224230                collector.add(h);
    225231        }
  • router/java/src/net/i2p/router/networkdb/kademlia/KBucketSet.java

    re99e25b r2552d99  
    101101   
    102102    public Set<Hash> getAll() { return getAll(Collections.EMPTY_SET); };
     103
    103104    public Set<Hash> getAll(Set<Hash> toIgnore) {
    104105        Set<Hash> all = new HashSet(1024);
    105106        for (int i = 0; i < _buckets.length; i++) {
    106             all.addAll(_buckets[i].getEntries(toIgnore));
    107         }
     107            all.addAll(_buckets[i].getEntries());
     108        }
     109        all.removeAll(toIgnore);
    108110        return all;
    109111    }
  • router/java/src/net/i2p/router/transport/TransportImpl.java

    re99e25b r2552d99  
    7070        _context.statManager().createRateStat("transport.receiveMessageTimeSlow", "How long it takes to read a message (when it takes more than a second)?", "Transport", new long[] { 60*1000l, 5*60*1000l, 10*60*1000l, 60*60*1000l, 24*60*60*1000l });
    7171        _context.statManager().createRequiredRateStat("transport.sendProcessingTime", "Time to process and send a message (ms)", "Transport", new long[] { 60*1000l, 10*60*1000l, 60*60*1000l, 24*60*60*1000l });
    72         _context.statManager().createRateStat("transport.sendProcessingTime." + getStyle(), "Time to process and send a message (ms)", "Transport", new long[] { 60*1000l });
     72        //_context.statManager().createRateStat("transport.sendProcessingTime." + getStyle(), "Time to process and send a message (ms)", "Transport", new long[] { 60*1000l });
    7373        _context.statManager().createRateStat("transport.expiredOnQueueLifetime", "How long a message that expires on our outbound queue is processed", "Transport", new long[] { 60*1000l, 10*60*1000l, 60*60*1000l, 24*60*60*1000l } );
    7474        _sendPool = new ArrayList(16);
     
    104104    public int getMaxConnections() {
    105105        String style = getStyle();
     106        // object churn
     107        String maxProp;
    106108        if (style.equals("SSU"))
    107             style = "udp";
    108         else
    109             style = style.toLowerCase(Locale.US);
     109            maxProp = "i2np.udp.maxConnections";
     110        else if (style.equals("NTCP"))
     111            maxProp = "i2np.ntcp.maxConnections";
     112        else // shouldn't happen
     113            maxProp = "i2np." + style.toLowerCase(Locale.US) + ".maxConnections";
    110114        int def = DEFAULT_MAX_CONNECTIONS;
    111115        RouterInfo ri = _context.router().getRouterInfo();
     
    120124            //def = def * 3 / 2;
    121125            def *= 3;
    122         return _context.getProperty("i2np." + style + ".maxConnections", def);
     126        return _context.getProperty(maxProp, def);
    123127    }
    124128
     
    326330
    327331        if (sendSuccessful) {
     332            // TODO fix this stat for SSU ticket #698
    328333            _context.statManager().addRateData("transport.sendProcessingTime", lifetime, lifetime);
    329             _context.statManager().addRateData("transport.sendProcessingTime." + getStyle(), lifetime, 0);
     334            // object churn. 33 ms for NTCP and 788 for SSU, but meaningless due to
     335            // differences in how it's computed (immediate vs. round trip)
     336            //_context.statManager().addRateData("transport.sendProcessingTime." + getStyle(), lifetime, 0);
    330337            _context.profileManager().messageSent(msg.getTarget().getIdentity().getHash(), getStyle(), sendTime, msg.getMessageSize());
    331338            _context.statManager().addRateData("transport.sendMessageSize", msg.getMessageSize(), sendTime);
  • router/java/src/net/i2p/router/transport/ntcp/NTCPConnection.java

    re99e25b r2552d99  
    759759       
    760760        DataHelper.toLong(buf.unencrypted, buf.unencryptedLength-4, 4, val);
     761        // TODO object churn
     762        // 1) store the length only
     763        // 2) in prepareNextWriteFast(), pull a byte buffer off a queue and encrypt to that
     764        // 3) change EventPumper.wantsWrite() to take a ByteBuffer arg
     765        // 4) in EventPumper.processWrite(), release the byte buffer
    761766        buf.encrypted = new byte[buf.unencryptedLength];
    762767       
     
    768773    }
    769774   
    770     private static int NUM_PREP_BUFS = 6;
     775    private static final int MIN_BUFS = 4;
     776    private static final int MAX_BUFS = 16;
     777    private static int NUM_PREP_BUFS;
     778    static {
     779        long maxMemory = Runtime.getRuntime().maxMemory();
     780        if (maxMemory == Long.MAX_VALUE)
     781            maxMemory = 96*1024*1024l;
     782        NUM_PREP_BUFS = (int) Math.max(MIN_BUFS, Math.min(MAX_BUFS, 1 + (maxMemory / (16*1024*1024))));
     783    }
    771784
    772785    private final static LinkedBlockingQueue<PrepBuffer> _bufs = new LinkedBlockingQueue(NUM_PREP_BUFS);
    773786
    774787    /**
     788     *  32KB each
    775789     *  @return initialized buffer
    776790     */
  • router/java/src/net/i2p/router/transport/udp/UDPTransport.java

    re99e25b r2552d99  
    11971197            }
    11981198
    1199             UDPAddress ua = new UDPAddress(addr);
    1200             if (ua.getIntroducerCount() <= 0) {
    1201                 InetAddress ia = ua.getHostAddress();
    1202                 if (ua.getPort() <= 0 || ia == null || !isValid(ia.getAddress()) ||
    1203                     Arrays.equals(ia.getAddress(), getExternalIP())) {
     1199            // don't do this - object churn parsing the whole thing
     1200            //UDPAddress ua = new UDPAddress(addr);
     1201            //if (ua.getIntroducerCount() <= 0) {
     1202            if (addr.getOption("ihost0") == null) {
     1203                String host = addr.getOption(UDPAddress.PROP_HOST);
     1204                String port = addr.getOption(UDPAddress.PROP_PORT);
     1205                if (host == null || port == null) {
    12041206                    markUnreachable(to);
    12051207                    return null;
     1208                }
     1209                try {
     1210                    InetAddress ia = InetAddress.getByName(host);
     1211                    int iport = Integer.parseInt(port);
     1212                    if (iport <= 0 || iport > 65535 || (!isValid(ia.getAddress())) ||
     1213                        Arrays.equals(ia.getAddress(), getExternalIP())) {
     1214                        markUnreachable(to);
     1215                        return null;
     1216                    }
     1217                } catch (UnknownHostException uhe) {
     1218                        markUnreachable(to);
     1219                        return null;
     1220                } catch (NumberFormatException nfe) {
     1221                        markUnreachable(to);
     1222                        return null;
    12061223                }
    12071224            }
Note: See TracChangeset for help on using the changeset viewer.