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

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

Issue 2002103002: Implement a QUIC No PRR connection option, NPRR. Protected by FLAGS_quic_allow_no_prr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@122422703
Patch Set: Created 4 years, 7 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
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_packets.h" 5 #include "net/quic/congestion_control/tcp_cubic_sender_packets.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "net/quic/congestion_control/prr_sender.h" 10 #include "net/quic/congestion_control/prr_sender.h"
(...skipping 23 matching lines...) Expand all
34 QuicConnectionStats* stats) 34 QuicConnectionStats* stats)
35 : rtt_stats_(rtt_stats), 35 : rtt_stats_(rtt_stats),
36 stats_(stats), 36 stats_(stats),
37 reno_(reno), 37 reno_(reno),
38 num_connections_(kDefaultNumConnections), 38 num_connections_(kDefaultNumConnections),
39 largest_sent_packet_number_(0), 39 largest_sent_packet_number_(0),
40 largest_acked_packet_number_(0), 40 largest_acked_packet_number_(0),
41 largest_sent_at_last_cutback_(0), 41 largest_sent_at_last_cutback_(0),
42 min4_mode_(false), 42 min4_mode_(false),
43 last_cutback_exited_slowstart_(false), 43 last_cutback_exited_slowstart_(false),
44 slow_start_large_reduction_(false) {} 44 slow_start_large_reduction_(false),
45 no_prr_(false) {}
45 46
46 TcpCubicSenderBase::~TcpCubicSenderBase() {} 47 TcpCubicSenderBase::~TcpCubicSenderBase() {}
47 48
48 void TcpCubicSenderBase::SetFromConfig(const QuicConfig& config, 49 void TcpCubicSenderBase::SetFromConfig(const QuicConfig& config,
49 Perspective perspective) { 50 Perspective perspective) {
50 if (perspective == Perspective::IS_SERVER) { 51 if (perspective == Perspective::IS_SERVER) {
51 if (config.HasReceivedConnectionOptions() && 52 if (config.HasReceivedConnectionOptions() &&
52 ContainsQuicTag(config.ReceivedConnectionOptions(), kIW03)) { 53 ContainsQuicTag(config.ReceivedConnectionOptions(), kIW03)) {
53 // Initial window experiment. 54 // Initial window experiment.
54 SetCongestionWindowInPackets(3); 55 SetCongestionWindowInPackets(3);
(...skipping 22 matching lines...) Expand all
77 ContainsQuicTag(config.ReceivedConnectionOptions(), kMIN4)) { 78 ContainsQuicTag(config.ReceivedConnectionOptions(), kMIN4)) {
78 // Min CWND of 4 experiment. 79 // Min CWND of 4 experiment.
79 min4_mode_ = true; 80 min4_mode_ = true;
80 SetMinCongestionWindowInPackets(1); 81 SetMinCongestionWindowInPackets(1);
81 } 82 }
82 if (config.HasReceivedConnectionOptions() && 83 if (config.HasReceivedConnectionOptions() &&
83 ContainsQuicTag(config.ReceivedConnectionOptions(), kSSLR)) { 84 ContainsQuicTag(config.ReceivedConnectionOptions(), kSSLR)) {
84 // Slow Start Fast Exit experiment. 85 // Slow Start Fast Exit experiment.
85 slow_start_large_reduction_ = true; 86 slow_start_large_reduction_ = true;
86 } 87 }
88 if (FLAGS_quic_allow_noprr && config.HasReceivedConnectionOptions() &&
89 ContainsQuicTag(config.ReceivedConnectionOptions(), kNPRR)) {
90 // Use unity pacing instead of PRR.
91 no_prr_ = true;
92 }
87 } 93 }
88 } 94 }
89 95
90 void TcpCubicSenderBase::ResumeConnectionState( 96 void TcpCubicSenderBase::ResumeConnectionState(
91 const CachedNetworkParameters& cached_network_params, 97 const CachedNetworkParameters& cached_network_params,
92 bool max_bandwidth_resumption) { 98 bool max_bandwidth_resumption) {
93 QuicBandwidth bandwidth = QuicBandwidth::FromBytesPerSecond( 99 QuicBandwidth bandwidth = QuicBandwidth::FromBytesPerSecond(
94 max_bandwidth_resumption 100 max_bandwidth_resumption
95 ? cached_network_params.max_bandwidth_estimate_bytes_per_second() 101 ? cached_network_params.max_bandwidth_estimate_bytes_per_second()
96 : cached_network_params.bandwidth_estimate_bytes_per_second()); 102 : cached_network_params.bandwidth_estimate_bytes_per_second());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 OnPacketAcked(it->first, it->second, bytes_in_flight); 138 OnPacketAcked(it->first, it->second, bytes_in_flight);
133 } 139 }
134 } 140 }
135 141
136 void TcpCubicSenderBase::OnPacketAcked(QuicPacketNumber acked_packet_number, 142 void TcpCubicSenderBase::OnPacketAcked(QuicPacketNumber acked_packet_number,
137 QuicByteCount acked_bytes, 143 QuicByteCount acked_bytes,
138 QuicByteCount bytes_in_flight) { 144 QuicByteCount bytes_in_flight) {
139 largest_acked_packet_number_ = 145 largest_acked_packet_number_ =
140 max(acked_packet_number, largest_acked_packet_number_); 146 max(acked_packet_number, largest_acked_packet_number_);
141 if (InRecovery()) { 147 if (InRecovery()) {
142 // PRR is used when in recovery. 148 if (!no_prr_) {
143 prr_.OnPacketAcked(acked_bytes); 149 // PRR is used when in recovery.
150 prr_.OnPacketAcked(acked_bytes);
151 }
144 return; 152 return;
145 } 153 }
146 MaybeIncreaseCwnd(acked_packet_number, acked_bytes, bytes_in_flight); 154 MaybeIncreaseCwnd(acked_packet_number, acked_bytes, bytes_in_flight);
147 if (InSlowStart()) { 155 if (InSlowStart()) {
148 hybrid_slow_start_.OnPacketAcked(acked_packet_number); 156 hybrid_slow_start_.OnPacketAcked(acked_packet_number);
149 } 157 }
150 } 158 }
151 159
152 bool TcpCubicSenderBase::OnPacketSent( 160 bool TcpCubicSenderBase::OnPacketSent(
153 QuicTime /*sent_time*/, 161 QuicTime /*sent_time*/,
(...skipping 15 matching lines...) Expand all
169 } 177 }
170 DCHECK_LT(largest_sent_packet_number_, packet_number); 178 DCHECK_LT(largest_sent_packet_number_, packet_number);
171 largest_sent_packet_number_ = packet_number; 179 largest_sent_packet_number_ = packet_number;
172 hybrid_slow_start_.OnPacketSent(packet_number); 180 hybrid_slow_start_.OnPacketSent(packet_number);
173 return true; 181 return true;
174 } 182 }
175 183
176 QuicTime::Delta TcpCubicSenderBase::TimeUntilSend( 184 QuicTime::Delta TcpCubicSenderBase::TimeUntilSend(
177 QuicTime /* now */, 185 QuicTime /* now */,
178 QuicByteCount bytes_in_flight) const { 186 QuicByteCount bytes_in_flight) const {
179 if (InRecovery()) { 187 if (!no_prr_ && InRecovery()) {
180 // PRR is used when in recovery. 188 // PRR is used when in recovery.
181 return prr_.TimeUntilSend(GetCongestionWindow(), bytes_in_flight, 189 return prr_.TimeUntilSend(GetCongestionWindow(), bytes_in_flight,
182 GetSlowStartThreshold()); 190 GetSlowStartThreshold());
183 } 191 }
184 if (GetCongestionWindow() > bytes_in_flight) { 192 if (GetCongestionWindow() > bytes_in_flight) {
185 return QuicTime::Delta::Zero(); 193 return QuicTime::Delta::Zero();
186 } 194 }
187 if (min4_mode_ && bytes_in_flight < 4 * kDefaultTCPMSS) { 195 if (min4_mode_ && bytes_in_flight < 4 * kDefaultTCPMSS) {
188 return QuicTime::Delta::Zero(); 196 return QuicTime::Delta::Zero();
189 } 197 }
190 return QuicTime::Delta::Infinite(); 198 return QuicTime::Delta::Infinite();
191 } 199 }
192 200
193 QuicBandwidth TcpCubicSenderBase::PacingRate() const { 201 QuicBandwidth TcpCubicSenderBase::PacingRate() const {
194 // We pace at twice the rate of the underlying sender's bandwidth estimate 202 // We pace at twice the rate of the underlying sender's bandwidth estimate
195 // during slow start and 1.25x during congestion avoidance to ensure pacing 203 // during slow start and 1.25x during congestion avoidance to ensure pacing
196 // doesn't prevent us from filling the window. 204 // doesn't prevent us from filling the window.
197 QuicTime::Delta srtt = rtt_stats_->smoothed_rtt(); 205 QuicTime::Delta srtt = rtt_stats_->smoothed_rtt();
198 if (srtt.IsZero()) { 206 if (srtt.IsZero()) {
199 srtt = QuicTime::Delta::FromMicroseconds(rtt_stats_->initial_rtt_us()); 207 srtt = QuicTime::Delta::FromMicroseconds(rtt_stats_->initial_rtt_us());
200 } 208 }
201 const QuicBandwidth bandwidth = 209 const QuicBandwidth bandwidth =
202 QuicBandwidth::FromBytesAndTimeDelta(GetCongestionWindow(), srtt); 210 QuicBandwidth::FromBytesAndTimeDelta(GetCongestionWindow(), srtt);
203 return bandwidth.Scale(InSlowStart() ? 2 : 1.25); 211 return bandwidth.Scale(InSlowStart() ? 2
212 : (no_prr_ && InRecovery() ? 1 : 1.25));
204 } 213 }
205 214
206 QuicBandwidth TcpCubicSenderBase::BandwidthEstimate() const { 215 QuicBandwidth TcpCubicSenderBase::BandwidthEstimate() const {
207 QuicTime::Delta srtt = rtt_stats_->smoothed_rtt(); 216 QuicTime::Delta srtt = rtt_stats_->smoothed_rtt();
208 if (srtt.IsZero()) { 217 if (srtt.IsZero()) {
209 // If we haven't measured an rtt, the bandwidth estimate is unknown. 218 // If we haven't measured an rtt, the bandwidth estimate is unknown.
210 return QuicBandwidth::Zero(); 219 return QuicBandwidth::Zero();
211 } 220 }
212 return QuicBandwidth::FromBytesAndTimeDelta(GetCongestionWindow(), srtt); 221 return QuicBandwidth::FromBytesAndTimeDelta(GetCongestionWindow(), srtt);
213 } 222 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 void TcpCubicSenderBase::OnConnectionMigration() { 261 void TcpCubicSenderBase::OnConnectionMigration() {
253 hybrid_slow_start_.Restart(); 262 hybrid_slow_start_.Restart();
254 prr_ = PrrSender(); 263 prr_ = PrrSender();
255 largest_sent_packet_number_ = 0; 264 largest_sent_packet_number_ = 0;
256 largest_acked_packet_number_ = 0; 265 largest_acked_packet_number_ = 0;
257 largest_sent_at_last_cutback_ = 0; 266 largest_sent_at_last_cutback_ = 0;
258 last_cutback_exited_slowstart_ = false; 267 last_cutback_exited_slowstart_ = false;
259 } 268 }
260 269
261 } // namespace net 270 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender_base.h ('k') | net/quic/congestion_control/tcp_cubic_sender_bytes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698