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

Side by Side Diff: net/quic/core/quic_connection.cc

Issue 2229023002: Track when QUIC connections are application limited. Protected by quic_enable_app_limited_check. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@129327247
Patch Set: git pull upper stream Created 4 years, 4 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/quic_connection.h ('k') | net/quic/core/quic_connection_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/core/quic_connection.h" 5 #include "net/quic/core/quic_connection.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2299 } 2299 }
2300 2300
2301 QuicConnection::ScopedPacketBundler::~ScopedPacketBundler() { 2301 QuicConnection::ScopedPacketBundler::~ScopedPacketBundler() {
2302 if (connection_ == nullptr) { 2302 if (connection_ == nullptr) {
2303 return; 2303 return;
2304 } 2304 }
2305 // If we changed the generator's batch state, restore original batch state. 2305 // If we changed the generator's batch state, restore original batch state.
2306 if (!already_in_batch_mode_) { 2306 if (!already_in_batch_mode_) {
2307 DVLOG(2) << "Leaving Batch Mode."; 2307 DVLOG(2) << "Leaving Batch Mode.";
2308 connection_->packet_generator_.FinishBatchOperations(); 2308 connection_->packet_generator_.FinishBatchOperations();
2309
2310 // Once all transmissions are done, check if there is any outstanding data
2311 // to send and notify the congestion controller if not.
2312 //
2313 // Note that this means that the application limited check will happen as
2314 // soon as the last bundler gets destroyed, which is typically after a
2315 // single stream write is finished. This means that if all the data from a
2316 // single write goes through the connection, the application-limited signal
2317 // will fire even if the caller does a write operation immediately after.
2318 // There are two important approaches to remedy this situation:
2319 // (1) Instantiate ScopedPacketBundler before performing multiple subsequent
2320 // writes, thus deferring this check until all writes are done.
2321 // (2) Write data in chunks sufficiently large so that they cause the
2322 // connection to be limited by the congestion control. Typically, this
2323 // would mean writing chunks larger than the product of the current
2324 // pacing rate and the pacer granularity. So, for instance, if the
2325 // pacing rate of the connection is 1 Gbps, and the pacer granularity is
2326 // 1 ms, the caller should send at least 125k bytes in order to not
2327 // be marked as application-limited.
2328 if (FLAGS_quic_enable_app_limited_check) {
2329 connection_->CheckIfApplicationLimited();
2330 }
2309 } 2331 }
2310 DCHECK_EQ(already_in_batch_mode_, 2332 DCHECK_EQ(already_in_batch_mode_,
2311 connection_->packet_generator_.InBatchMode()); 2333 connection_->packet_generator_.InBatchMode());
2312 } 2334 }
2313 2335
2314 QuicConnection::ScopedRetransmissionScheduler::ScopedRetransmissionScheduler( 2336 QuicConnection::ScopedRetransmissionScheduler::ScopedRetransmissionScheduler(
2315 QuicConnection* connection) 2337 QuicConnection* connection)
2316 : connection_(connection), 2338 : connection_(connection),
2317 already_delayed_(connection_->delay_setting_retransmission_alarm_) { 2339 already_delayed_(connection_->delay_setting_retransmission_alarm_) {
2318 connection_->delay_setting_retransmission_alarm_ = true; 2340 connection_->delay_setting_retransmission_alarm_ = true;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 // There may be a value in making this delay adaptive with the help of 2537 // There may be a value in making this delay adaptive with the help of
2516 // the sender and a signaling mechanism -- if the sender uses a 2538 // the sender and a signaling mechanism -- if the sender uses a
2517 // different MinRTO, we may get spurious retransmissions. May not have 2539 // different MinRTO, we may get spurious retransmissions. May not have
2518 // any benefits, but if the delayed ack becomes a significant source 2540 // any benefits, but if the delayed ack becomes a significant source
2519 // of (likely, tail) latency, then consider such a mechanism. 2541 // of (likely, tail) latency, then consider such a mechanism.
2520 const QuicTime::Delta QuicConnection::DelayedAckTime() { 2542 const QuicTime::Delta QuicConnection::DelayedAckTime() {
2521 return QuicTime::Delta::FromMilliseconds( 2543 return QuicTime::Delta::FromMilliseconds(
2522 min(kMaxDelayedAckTimeMs, kMinRetransmissionTimeMs / 2)); 2544 min(kMaxDelayedAckTimeMs, kMinRetransmissionTimeMs / 2));
2523 } 2545 }
2524 2546
2547 void QuicConnection::CheckIfApplicationLimited() {
2548 if (queued_packets_.empty() &&
2549 !sent_packet_manager_->HasPendingRetransmissions() &&
2550 !visitor_->WillingAndAbleToWrite()) {
2551 sent_packet_manager_->OnApplicationLimited();
2552 }
2553 }
2554
2525 } // namespace net 2555 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_connection.h ('k') | net/quic/core/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698