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

Side by Side Diff: net/quic/core/congestion_control/bbr_sender.cc

Issue 2962033002: Add a new connection option(BBRR) to enable BBR's rate based recovery. Protected by FLAGS_quic_rel… (Closed)
Patch Set: Rebase Created 3 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
« no previous file with comments | « net/quic/core/congestion_control/bbr_sender.h ('k') | net/quic/core/crypto/crypto_protocol.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/core/congestion_control/bbr_sender.h" 5 #include "net/quic/core/congestion_control/bbr_sender.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "net/quic/core/congestion_control/rtt_stats.h" 10 #include "net/quic/core/congestion_control/rtt_stats.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 is_at_full_bandwidth_(false), 112 is_at_full_bandwidth_(false),
113 rounds_without_bandwidth_gain_(0), 113 rounds_without_bandwidth_gain_(0),
114 bandwidth_at_last_round_(QuicBandwidth::Zero()), 114 bandwidth_at_last_round_(QuicBandwidth::Zero()),
115 exiting_quiescence_(false), 115 exiting_quiescence_(false),
116 exit_probe_rtt_at_(QuicTime::Zero()), 116 exit_probe_rtt_at_(QuicTime::Zero()),
117 probe_rtt_round_passed_(false), 117 probe_rtt_round_passed_(false),
118 last_sample_is_app_limited_(false), 118 last_sample_is_app_limited_(false),
119 recovery_state_(NOT_IN_RECOVERY), 119 recovery_state_(NOT_IN_RECOVERY),
120 end_recovery_at_(0), 120 end_recovery_at_(0),
121 recovery_window_(max_congestion_window_), 121 recovery_window_(max_congestion_window_),
122 bytes_recently_acked_(0) { 122 bytes_recently_acked_(0),
123 rate_based_recovery_(false) {
123 EnterStartupMode(); 124 EnterStartupMode();
124 } 125 }
125 126
126 BbrSender::~BbrSender() {} 127 BbrSender::~BbrSender() {}
127 128
128 bool BbrSender::InSlowStart() const { 129 bool BbrSender::InSlowStart() const {
129 return mode_ == STARTUP; 130 return mode_ == STARTUP;
130 } 131 }
131 132
132 bool BbrSender::OnPacketSent(QuicTime sent_time, 133 bool BbrSender::OnPacketSent(QuicTime sent_time,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 198
198 QuicBandwidth BbrSender::BandwidthEstimate() const { 199 QuicBandwidth BbrSender::BandwidthEstimate() const {
199 return max_bandwidth_.GetBest(); 200 return max_bandwidth_.GetBest();
200 } 201 }
201 202
202 QuicByteCount BbrSender::GetCongestionWindow() const { 203 QuicByteCount BbrSender::GetCongestionWindow() const {
203 if (mode_ == PROBE_RTT) { 204 if (mode_ == PROBE_RTT) {
204 return kMinimumCongestionWindow; 205 return kMinimumCongestionWindow;
205 } 206 }
206 207
207 if (InRecovery()) { 208 if (InRecovery() && !rate_based_recovery_) {
208 return std::min(congestion_window_, recovery_window_); 209 return std::min(congestion_window_, recovery_window_);
209 } 210 }
210 211
211 return congestion_window_; 212 return congestion_window_;
212 } 213 }
213 214
214 QuicByteCount BbrSender::GetSlowStartThreshold() const { 215 QuicByteCount BbrSender::GetSlowStartThreshold() const {
215 return 0; 216 return 0;
216 } 217 }
217 218
218 bool BbrSender::InRecovery() const { 219 bool BbrSender::InRecovery() const {
219 return recovery_state_ != NOT_IN_RECOVERY; 220 return recovery_state_ != NOT_IN_RECOVERY;
220 } 221 }
221 222
222 void BbrSender::SetFromConfig(const QuicConfig& config, 223 void BbrSender::SetFromConfig(const QuicConfig& config,
223 Perspective perspective) { 224 Perspective perspective) {
224 if (config.HasClientRequestedIndependentOption(k1RTT, perspective)) { 225 if (config.HasClientRequestedIndependentOption(k1RTT, perspective)) {
225 num_startup_rtts_ = 1; 226 num_startup_rtts_ = 1;
226 } 227 }
227 if (config.HasClientRequestedIndependentOption(k2RTT, perspective)) { 228 if (config.HasClientRequestedIndependentOption(k2RTT, perspective)) {
228 num_startup_rtts_ = 2; 229 num_startup_rtts_ = 2;
229 } 230 }
231 if (FLAGS_quic_reloadable_flag_quic_bbr_rate_recovery &&
232 config.HasClientRequestedIndependentOption(kBBRR, perspective)) {
233 rate_based_recovery_ = true;
234 }
230 } 235 }
231 236
232 void BbrSender::ResumeConnectionState( 237 void BbrSender::ResumeConnectionState(
233 const CachedNetworkParameters& cached_network_params, 238 const CachedNetworkParameters& cached_network_params,
234 bool max_bandwidth_resumption) { 239 bool max_bandwidth_resumption) {
235 if (!FLAGS_quic_reloadable_flag_quic_bbr_bandwidth_resumption) { 240 if (!FLAGS_quic_reloadable_flag_quic_bbr_bandwidth_resumption) {
236 return; 241 return;
237 } 242 }
238 243
239 QUIC_FLAG_COUNT(quic_reloadable_flag_quic_bbr_bandwidth_resumption); 244 QUIC_FLAG_COUNT(quic_reloadable_flag_quic_bbr_bandwidth_resumption);
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 max_ack_height_.Update(aggregation_epoch_bytes_ - expected_bytes_acked, 608 max_ack_height_.Update(aggregation_epoch_bytes_ - expected_bytes_acked,
604 round_trip_count_); 609 round_trip_count_);
605 } 610 }
606 611
607 void BbrSender::CalculatePacingRate() { 612 void BbrSender::CalculatePacingRate() {
608 if (BandwidthEstimate().IsZero()) { 613 if (BandwidthEstimate().IsZero()) {
609 return; 614 return;
610 } 615 }
611 616
612 QuicBandwidth target_rate = pacing_gain_ * BandwidthEstimate(); 617 QuicBandwidth target_rate = pacing_gain_ * BandwidthEstimate();
618 if (rate_based_recovery_ && InRecovery()) {
619 QUIC_FLAG_COUNT(quic_reloadable_flag_quic_bbr_rate_recovery);
620 pacing_rate_ = pacing_gain_ * max_bandwidth_.GetThirdBest();
621 }
613 if (is_at_full_bandwidth_) { 622 if (is_at_full_bandwidth_) {
614 pacing_rate_ = target_rate; 623 pacing_rate_ = target_rate;
615 return; 624 return;
616 } 625 }
617 626
618 // Pace at the rate of initial_window / RTT as soon as RTT measurements are 627 // Pace at the rate of initial_window / RTT as soon as RTT measurements are
619 // available. 628 // available.
620 if (pacing_rate_.IsZero() && !rtt_stats_->min_rtt().IsZero()) { 629 if (pacing_rate_.IsZero() && !rtt_stats_->min_rtt().IsZero()) {
621 pacing_rate_ = QuicBandwidth::FromBytesAndTimeDelta( 630 pacing_rate_ = QuicBandwidth::FromBytesAndTimeDelta(
622 initial_congestion_window_, rtt_stats_->min_rtt()); 631 initial_congestion_window_, rtt_stats_->min_rtt());
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 congestion_window_ = congestion_window_ + bytes_acked; 682 congestion_window_ = congestion_window_ + bytes_acked;
674 } 683 }
675 684
676 // Enforce the limits on the congestion window. 685 // Enforce the limits on the congestion window.
677 congestion_window_ = std::max(congestion_window_, kMinimumCongestionWindow); 686 congestion_window_ = std::max(congestion_window_, kMinimumCongestionWindow);
678 congestion_window_ = std::min(congestion_window_, max_congestion_window_); 687 congestion_window_ = std::min(congestion_window_, max_congestion_window_);
679 } 688 }
680 689
681 void BbrSender::CalculateRecoveryWindow(QuicByteCount bytes_acked, 690 void BbrSender::CalculateRecoveryWindow(QuicByteCount bytes_acked,
682 QuicByteCount bytes_lost) { 691 QuicByteCount bytes_lost) {
692 if (rate_based_recovery_) {
693 return;
694 }
683 if (FLAGS_quic_reloadable_flag_quic_bbr_fix_conservation2) { 695 if (FLAGS_quic_reloadable_flag_quic_bbr_fix_conservation2) {
684 if (recovery_state_ == NOT_IN_RECOVERY) { 696 if (recovery_state_ == NOT_IN_RECOVERY) {
685 return; 697 return;
686 } 698 }
687 699
688 // Set up the initial recovery window. 700 // Set up the initial recovery window.
689 if (recovery_window_ == 0) { 701 if (recovery_window_ == 0) {
690 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_bbr_fix_conservation2, 2, 3); 702 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_bbr_fix_conservation2, 2, 3);
691 recovery_window_ = unacked_packets_->bytes_in_flight() + bytes_acked; 703 recovery_window_ = unacked_packets_->bytes_in_flight() + bytes_acked;
692 recovery_window_ = std::max(kMinimumCongestionWindow, recovery_window_); 704 recovery_window_ = std::max(kMinimumCongestionWindow, recovery_window_);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 os << "Minimum RTT timestamp: " << state.min_rtt_timestamp.ToDebuggingValue() 799 os << "Minimum RTT timestamp: " << state.min_rtt_timestamp.ToDebuggingValue()
788 << std::endl; 800 << std::endl;
789 801
790 os << "Last sample is app-limited: " 802 os << "Last sample is app-limited: "
791 << (state.last_sample_is_app_limited ? "yes" : "no"); 803 << (state.last_sample_is_app_limited ? "yes" : "no");
792 804
793 return os; 805 return os;
794 } 806 }
795 807
796 } // namespace net 808 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/congestion_control/bbr_sender.h ('k') | net/quic/core/crypto/crypto_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698