Changeset f8bc6f8


Ignore:
Timestamp:
Aug 27, 2012 8:36:24 PM (7 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
d305eb6
Parents:
9099937
Message:
  • Streaming: Limit amount of slow-start exponential growth
Location:
apps/streaming/java/src/net/i2p/client/streaming
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • apps/streaming/java/src/net/i2p/client/streaming/ConnectionOptions.java

    r9099937 rf8bc6f8  
    101101    private static final int DEFAULT_INACTIVITY_TIMEOUT = 90*1000;
    102102    private static final int DEFAULT_INACTIVITY_ACTION = INACTIVITY_ACTION_SEND;
     103    private static final int DEFAULT_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR = 1;
     104    private static final int DEFAULT_SLOW_START_GROWTH_RATE_FACTOR = 1;
    103105
    104106
     
    328330        setInactivityAction(getInt(opts, PROP_INACTIVITY_ACTION, DEFAULT_INACTIVITY_ACTION));
    329331        setInboundBufferSize(getMaxMessageSize() * (Connection.MAX_WINDOW_SIZE + 2));
    330         setCongestionAvoidanceGrowthRateFactor(getInt(opts, PROP_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR, 1));
    331         setSlowStartGrowthRateFactor(getInt(opts, PROP_SLOW_START_GROWTH_RATE_FACTOR, 1));
     332        setCongestionAvoidanceGrowthRateFactor(getInt(opts, PROP_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR,
     333                                                      DEFAULT_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR));
     334        setSlowStartGrowthRateFactor(getInt(opts, PROP_SLOW_START_GROWTH_RATE_FACTOR,
     335                                            DEFAULT_SLOW_START_GROWTH_RATE_FACTOR));
    332336        // overrides default in super()
    333337        setConnectTimeout(getInt(opts, PROP_CONNECT_TIMEOUT, Connection.DISCONNECT_TIMEOUT));
     
    379383        setInboundBufferSize(getMaxMessageSize() * (Connection.MAX_WINDOW_SIZE + 2));
    380384        if (opts.contains(PROP_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR))
    381             setCongestionAvoidanceGrowthRateFactor(getInt(opts, PROP_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR, 2));
     385            setCongestionAvoidanceGrowthRateFactor(getInt(opts, PROP_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR,
     386                                                          DEFAULT_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR));
    382387        if (opts.contains(PROP_SLOW_START_GROWTH_RATE_FACTOR))
    383             setSlowStartGrowthRateFactor(getInt(opts, PROP_SLOW_START_GROWTH_RATE_FACTOR, 2));
     388            setSlowStartGrowthRateFactor(getInt(opts, PROP_SLOW_START_GROWTH_RATE_FACTOR,
     389                                                DEFAULT_SLOW_START_GROWTH_RATE_FACTOR));
    384390        if (opts.containsKey(PROP_CONNECT_TIMEOUT))
    385391            // wow 5 minutes!!! FIXME!!
  • apps/streaming/java/src/net/i2p/client/streaming/ConnectionPacketHandler.java

    r9099937 rf8bc6f8  
    2424    private final I2PAppContext _context;
    2525    private final Log _log;
     26
     27    public static final int MAX_SLOW_START_WINDOW = 24;
    2628   
    2729    public ConnectionPacketHandler(I2PAppContext context) {
     
    368370                    // always grow at least 1
    369371                    int factor = con.getOptions().getSlowStartGrowthRateFactor();
    370                     if (factor <= 1)
    371                         newWindowSize += acked;
    372                     else if (acked < factor)
     372                    if (factor <= 1) {
     373                        // above a certain point, don't grow exponentially
     374                        // as it often leads to a big packet loss (30-50) all at once that
     375                        // takes quite a while (a minute or more) to recover from,
     376                        // especially if crypto tags are lost
     377                        if (newWindowSize >= MAX_SLOW_START_WINDOW)
     378                            newWindowSize++;
     379                        else
     380                            newWindowSize = Math.min(MAX_SLOW_START_WINDOW, newWindowSize + acked);
     381                    } else if (acked < factor)
    373382                        newWindowSize++;
    374383                    else
  • apps/streaming/java/src/net/i2p/client/streaming/TCBShare.java

    r9099937 rf8bc6f8  
    3232    private static final double WDW_DAMPENING = 0.75;
    3333    private static final int MAX_RTT = ((int) Connection.MAX_RESEND_DELAY) / 2;
    34     private static final int MAX_WINDOW_SIZE = Connection.MAX_WINDOW_SIZE / 4;
     34    private static final int MAX_WINDOW_SIZE = ConnectionPacketHandler.MAX_SLOW_START_WINDOW;
    3535   
    3636    public TCBShare(I2PAppContext ctx, SimpleTimer2 timer) {
     
    4646    }
    4747
     48    /** retrieve from cache */
    4849    public void updateOptsFromShare(Connection con) {
    4950        Destination dest = con.getRemotePeer();
     
    6667    }
    6768
     69    /** store to cache */
    6870    public void updateShareOpts(Connection con) {
    6971        Destination dest = con.getRemotePeer();
Note: See TracChangeset for help on using the changeset viewer.