Changeset 1f32274


Ignore:
Timestamp:
Aug 10, 2013 9:03:05 PM (7 years ago)
Author:
zab2 <zab2@…>
Branches:
master
Children:
74e2383
Parents:
afda1da
Message:

Reduce initial ack delay to 1000

Rework the logic for acking duplicate packets

Files:
3 edited

Legend:

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

    rafda1da r1f32274  
    128128    static final int DEFAULT_MAX_SENDS = 8;
    129129    public static final int DEFAULT_INITIAL_RTT = 8*1000;   
    130     public static final int DEFAULT_INITIAL_ACK_DELAY = 2*1000;   
     130    public static final int DEFAULT_INITIAL_ACK_DELAY = 1000; 
    131131    static final int MIN_WINDOW_SIZE = 1;
    132132    private static final boolean DEFAULT_ANSWER_PINGS = true;
  • apps/streaming/java/src/net/i2p/client/streaming/ConnectionPacketHandler.java

    rafda1da r1f32274  
    3838        _context.statManager().createRateStat("stream.con.initialRTT.in", "What is the actual RTT for the first packet of an inbound conn?", "Stream", new long[] { 10*60*1000, 60*60*1000 });
    3939        _context.statManager().createRateStat("stream.con.initialRTT.out", "What is the actual RTT for the first packet of an outbound conn?", "Stream", new long[] { 10*60*1000, 60*60*1000 });
     40        _context.statManager().createFrequencyStat("stream.ack.dup.immediate","How often duplicate packets get acked immediately","Stream",new long[] { 10*60*1000, 60*60*1000 });
     41        _context.statManager().createRateStat("stream.ack.dup.sent","Whether the ack for a duplicate packet was sent as scheduled","Stream",new long[] { 10*60*1000, 60*60*1000 });
    4042    }
    4143   
     
    185187       
    186188                // take note of congestion
     189               
     190                final long now = _context.clock().now();
     191                final int ackDelay = con.getOptions().getSendAckDelay();
     192                final long lastSendTime = con.getLastSendTime();
     193               
    187194                if (_log.shouldLog(Log.WARN))
    188                     _log.warn("congestion.. dup " + packet);
    189                 _context.simpleScheduler().addEvent(new AckDup(con), con.getOptions().getSendAckDelay());
    190                 //con.setNextSendTime(_context.clock().now() + con.getOptions().getSendAckDelay());
    191                 //fastAck = true;
     195                    _log.warn(String.format("%s congestion.. dup packet %s now %d ackDelay %d lastSend %d",
     196                                    con, packet, now, ackDelay, lastSendTime));
     197               
     198                final long nextSendTime = lastSendTime + ackDelay;
     199                if (nextSendTime <= now) {
     200                    if (_log.shouldLog(Log.DEBUG))
     201                        _log.debug("immediate ack");
     202                    con.ackImmediately();
     203                    _context.statManager().getFrequency("stream.ack.dup.immediate").eventOccurred();
     204                } else {
     205                    final long delay = nextSendTime - now;
     206                    if (_log.shouldLog(Log.DEBUG))
     207                        _log.debug("scheduling ack in "+delay);
     208                    _context.simpleScheduler().addEvent(new AckDup(con), delay);
     209                }
     210
    192211            } else {
    193212                if (packet.isFlagSet(Packet.FLAG_SYNCHRONIZE)) {
     
    543562
    544563        public void timeReached() {
     564            boolean sent = false;
    545565            if (_con.getLastSendTime() <= _created) {
    546566                if (_con.getResetReceived() || _con.getResetSent()) {
     
    555575                // ack now
    556576                _con.ackImmediately();
     577                sent = true;
    557578            } else {               
    558579                if (_log.shouldLog(Log.DEBUG))
    559580                    _log.debug("Ack dup on " + _con + ", but we have sent (" + (_con.getLastSendTime()-_created) + ")");
    560581            }
     582            _context.statManager().getRate("stream.ack.dup.sent").addData(sent ? 1 : 0);
    561583        }
    562584    }
  • history.txt

    rafda1da r1f32274  
     12013-08-11 zab
     2 * Streaming:
     3   - reduce initial ack delay 2000->1000
     4   - rework the logic of acking duplicate packets
     5
    16* 2013-08-10 0.9.7.1 released
    27
Note: See TracChangeset for help on using the changeset viewer.