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

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

Issue 964483005: Remove stats for recording reno vs cubic mode in internal server's varz. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/congestion_control/cubic.h ('k') | net/quic/congestion_control/cubic_test.cc » ('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 (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/cubic.h" 5 #include "net/quic/congestion_control/cubic.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 20 matching lines...) Expand all
31 31
32 const uint32 kDefaultNumConnections = 2; 32 const uint32 kDefaultNumConnections = 2;
33 const float kBeta = 0.7f; // Default Cubic backoff factor. 33 const float kBeta = 0.7f; // Default Cubic backoff factor.
34 // Additional backoff factor when loss occurs in the concave part of the Cubic 34 // Additional backoff factor when loss occurs in the concave part of the Cubic
35 // curve. This additional backoff factor is expected to give up bandwidth to 35 // curve. This additional backoff factor is expected to give up bandwidth to
36 // new concurrent flows and speed up convergence. 36 // new concurrent flows and speed up convergence.
37 const float kBetaLastMax = 0.85f; 37 const float kBetaLastMax = 0.85f;
38 38
39 } // namespace 39 } // namespace
40 40
41 Cubic::Cubic(const QuicClock* clock, QuicConnectionStats* stats) 41 Cubic::Cubic(const QuicClock* clock)
42 : clock_(clock), 42 : clock_(clock),
43 num_connections_(kDefaultNumConnections), 43 num_connections_(kDefaultNumConnections),
44 epoch_(QuicTime::Zero()), 44 epoch_(QuicTime::Zero()),
45 last_update_time_(QuicTime::Zero()), 45 last_update_time_(QuicTime::Zero()) {
46 stats_(stats) {
47 Reset(); 46 Reset();
48 } 47 }
49 48
50 void Cubic::SetNumConnections(int num_connections) { 49 void Cubic::SetNumConnections(int num_connections) {
51 num_connections_ = num_connections; 50 num_connections_ = num_connections;
52 } 51 }
53 52
54 float Cubic::Alpha() const { 53 float Cubic::Alpha() const {
55 // TCPFriendly alpha is described in Section 3.3 of the CUBIC paper. Note that 54 // TCPFriendly alpha is described in Section 3.3 of the CUBIC paper. Note that
56 // beta here is a cwnd multiplier, and is equal to 1-beta from the paper. 55 // beta here is a cwnd multiplier, and is equal to 1-beta from the paper.
(...skipping 15 matching lines...) Expand all
72 last_update_time_ = QuicTime::Zero(); // Reset time. 71 last_update_time_ = QuicTime::Zero(); // Reset time.
73 last_congestion_window_ = 0; 72 last_congestion_window_ = 0;
74 last_max_congestion_window_ = 0; 73 last_max_congestion_window_ = 0;
75 acked_packets_count_ = 0; 74 acked_packets_count_ = 0;
76 estimated_tcp_congestion_window_ = 0; 75 estimated_tcp_congestion_window_ = 0;
77 origin_point_congestion_window_ = 0; 76 origin_point_congestion_window_ = 0;
78 time_to_origin_point_ = 0; 77 time_to_origin_point_ = 0;
79 last_target_congestion_window_ = 0; 78 last_target_congestion_window_ = 0;
80 } 79 }
81 80
82 void Cubic::UpdateCongestionControlStats(QuicPacketCount new_cubic_mode_cwnd,
83 QuicPacketCount new_reno_mode_cwnd) {
84 QuicPacketCount highest_new_cwnd = max(new_cubic_mode_cwnd,
85 new_reno_mode_cwnd);
86 if (last_congestion_window_ < highest_new_cwnd) {
87 // cwnd will increase to highest_new_cwnd.
88 stats_->cwnd_increase_congestion_avoidance +=
89 highest_new_cwnd - last_congestion_window_;
90 if (new_cubic_mode_cwnd > new_reno_mode_cwnd) {
91 // This cwnd increase is due to cubic mode.
92 stats_->cwnd_increase_cubic_mode +=
93 new_cubic_mode_cwnd - last_congestion_window_;
94 }
95 }
96 }
97
98 QuicPacketCount Cubic::CongestionWindowAfterPacketLoss( 81 QuicPacketCount Cubic::CongestionWindowAfterPacketLoss(
99 QuicPacketCount current_congestion_window) { 82 QuicPacketCount current_congestion_window) {
100 if (current_congestion_window < last_max_congestion_window_) { 83 if (current_congestion_window < last_max_congestion_window_) {
101 // We never reached the old max, so assume we are competing with another 84 // We never reached the old max, so assume we are competing with another
102 // flow. Use our extra back off factor to allow the other flow to go up. 85 // flow. Use our extra back off factor to allow the other flow to go up.
103 last_max_congestion_window_ = 86 last_max_congestion_window_ =
104 static_cast<int>(kBetaLastMax * current_congestion_window); 87 static_cast<int>(kBetaLastMax * current_congestion_window);
105 } else { 88 } else {
106 last_max_congestion_window_ = current_congestion_window; 89 last_max_congestion_window_ = current_congestion_window;
107 } 90 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // Update estimated TCP congestion_window. 147 // Update estimated TCP congestion_window.
165 QuicPacketCount required_ack_count = static_cast<QuicPacketCount>( 148 QuicPacketCount required_ack_count = static_cast<QuicPacketCount>(
166 estimated_tcp_congestion_window_ / Alpha()); 149 estimated_tcp_congestion_window_ / Alpha());
167 if (acked_packets_count_ < required_ack_count) { 150 if (acked_packets_count_ < required_ack_count) {
168 break; 151 break;
169 } 152 }
170 acked_packets_count_ -= required_ack_count; 153 acked_packets_count_ -= required_ack_count;
171 estimated_tcp_congestion_window_++; 154 estimated_tcp_congestion_window_++;
172 } 155 }
173 156
174 // Update cubic mode and reno mode stats in QuicConnectionStats.
175 UpdateCongestionControlStats(target_congestion_window,
176 estimated_tcp_congestion_window_);
177
178 // We have a new cubic congestion window. 157 // We have a new cubic congestion window.
179 last_target_congestion_window_ = target_congestion_window; 158 last_target_congestion_window_ = target_congestion_window;
180 159
181 // Compute target congestion_window based on cubic target and estimated TCP 160 // Compute target congestion_window based on cubic target and estimated TCP
182 // congestion_window, use highest (fastest). 161 // congestion_window, use highest (fastest).
183 if (target_congestion_window < estimated_tcp_congestion_window_) { 162 if (target_congestion_window < estimated_tcp_congestion_window_) {
184 target_congestion_window = estimated_tcp_congestion_window_; 163 target_congestion_window = estimated_tcp_congestion_window_;
185 } 164 }
186 165
187 DVLOG(1) << "Target congestion_window: " << target_congestion_window; 166 DVLOG(1) << "Target congestion_window: " << target_congestion_window;
188 return target_congestion_window; 167 return target_congestion_window;
189 } 168 }
190 169
191 } // namespace net 170 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/cubic.h ('k') | net/quic/congestion_control/cubic_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698