Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: net/quic/congestion_control/tcp_cubic_sender.cc

Issue 352403002: Repair the CWND reduction caused by spurious RTO's in QUIC's congestion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/congestion_control/tcp_cubic_sender.h" 5 #include "net/quic/congestion_control/tcp_cubic_sender.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "net/quic/congestion_control/rtt_stats.h" 10 #include "net/quic/congestion_control/rtt_stats.h"
(...skipping 28 matching lines...) Expand all
39 congestion_window_count_(0), 39 congestion_window_count_(0),
40 receive_window_(kDefaultReceiveWindow), 40 receive_window_(kDefaultReceiveWindow),
41 prr_out_(0), 41 prr_out_(0),
42 prr_delivered_(0), 42 prr_delivered_(0),
43 ack_count_since_loss_(0), 43 ack_count_since_loss_(0),
44 bytes_in_flight_before_loss_(0), 44 bytes_in_flight_before_loss_(0),
45 largest_sent_sequence_number_(0), 45 largest_sent_sequence_number_(0),
46 largest_acked_sequence_number_(0), 46 largest_acked_sequence_number_(0),
47 largest_sent_at_last_cutback_(0), 47 largest_sent_at_last_cutback_(0),
48 congestion_window_(kInitialCongestionWindow), 48 congestion_window_(kInitialCongestionWindow),
49 previous_congestion_window_(0),
49 slowstart_threshold_(max_tcp_congestion_window), 50 slowstart_threshold_(max_tcp_congestion_window),
51 previous_slowstart_threshold_(0),
50 last_cutback_exited_slowstart_(false), 52 last_cutback_exited_slowstart_(false),
51 max_tcp_congestion_window_(max_tcp_congestion_window) { 53 max_tcp_congestion_window_(max_tcp_congestion_window) {
52 } 54 }
53 55
54 TcpCubicSender::~TcpCubicSender() { 56 TcpCubicSender::~TcpCubicSender() {
55 UMA_HISTOGRAM_COUNTS("Net.QuicSession.FinalTcpCwnd", congestion_window_); 57 UMA_HISTOGRAM_COUNTS("Net.QuicSession.FinalTcpCwnd", congestion_window_);
56 } 58 }
57 59
58 bool TcpCubicSender::InSlowStart() const { 60 bool TcpCubicSender::InSlowStart() const {
59 return congestion_window_ < slowstart_threshold_; 61 return congestion_window_ < slowstart_threshold_;
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 congestion_window_ = min(max_tcp_congestion_window_, 269 congestion_window_ = min(max_tcp_congestion_window_,
268 cubic_.CongestionWindowAfterAck( 270 cubic_.CongestionWindowAfterAck(
269 congestion_window_, rtt_stats_->min_rtt())); 271 congestion_window_, rtt_stats_->min_rtt()));
270 DVLOG(1) << "Cubic; congestion window: " << congestion_window_ 272 DVLOG(1) << "Cubic; congestion window: " << congestion_window_
271 << " slowstart threshold: " << slowstart_threshold_; 273 << " slowstart threshold: " << slowstart_threshold_;
272 } 274 }
273 } 275 }
274 276
275 void TcpCubicSender::OnRetransmissionTimeout(bool packets_retransmitted) { 277 void TcpCubicSender::OnRetransmissionTimeout(bool packets_retransmitted) {
276 largest_sent_at_last_cutback_ = 0; 278 largest_sent_at_last_cutback_ = 0;
277 if (packets_retransmitted) { 279 if (!packets_retransmitted) {
278 cubic_.Reset(); 280 return;
279 hybrid_slow_start_.Restart();
280 congestion_window_ = kMinimumCongestionWindow;
281 } 281 }
282 cubic_.Reset();
283 hybrid_slow_start_.Restart();
284 previous_slowstart_threshold_ = slowstart_threshold_;
285 slowstart_threshold_ = congestion_window_ / 2;
286 previous_congestion_window_ = congestion_window_;
287 congestion_window_ = kMinimumCongestionWindow;
288 }
289
290 void TcpCubicSender::RevertRetransmissionTimeout() {
291 if (previous_congestion_window_ == 0) {
292 LOG(DFATAL) << "No previous congestion window to revert to.";
293 return;
294 }
295 congestion_window_ = previous_congestion_window_;
296 slowstart_threshold_ = previous_slowstart_threshold_;
297 previous_congestion_window_ = 0;
282 } 298 }
283 299
284 void TcpCubicSender::PrrOnPacketLost(QuicByteCount bytes_in_flight) { 300 void TcpCubicSender::PrrOnPacketLost(QuicByteCount bytes_in_flight) {
285 prr_out_ = 0; 301 prr_out_ = 0;
286 bytes_in_flight_before_loss_ = bytes_in_flight; 302 bytes_in_flight_before_loss_ = bytes_in_flight;
287 prr_delivered_ = 0; 303 prr_delivered_ = 0;
288 ack_count_since_loss_ = 0; 304 ack_count_since_loss_ = 0;
289 } 305 }
290 306
291 void TcpCubicSender::PrrOnPacketAcked(QuicByteCount acked_bytes) { 307 void TcpCubicSender::PrrOnPacketAcked(QuicByteCount acked_bytes) {
(...skipping 23 matching lines...) Expand all
315 // AvailableSendWindow = 331 // AvailableSendWindow =
316 // CEIL(prr_delivered * ssthresh / BytesInFlightAtLoss) - prr_sent 332 // CEIL(prr_delivered * ssthresh / BytesInFlightAtLoss) - prr_sent
317 if (prr_delivered_ * slowstart_threshold_ * kMaxSegmentSize > 333 if (prr_delivered_ * slowstart_threshold_ * kMaxSegmentSize >
318 prr_out_ * bytes_in_flight_before_loss_) { 334 prr_out_ * bytes_in_flight_before_loss_) {
319 return QuicTime::Delta::Zero(); 335 return QuicTime::Delta::Zero();
320 } 336 }
321 return QuicTime::Delta::Infinite(); 337 return QuicTime::Delta::Infinite();
322 } 338 }
323 339
324 } // namespace net 340 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.h ('k') | net/quic/congestion_control/tcp_cubic_sender_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698