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

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

Issue 2825093002: Continue sending at the max bandwidth measured in the last two rounds for another SRTT. Protected … (Closed)
Patch Set: Created 3 years, 8 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.cc ('k') | net/quic/core/quic_flags_list.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 <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 sender_->ExportDebugState().max_bandwidth); 336 sender_->ExportDebugState().max_bandwidth);
337 // TODO(ianswett): Expect 0 packets are lost once BBR no longer measures 337 // TODO(ianswett): Expect 0 packets are lost once BBR no longer measures
338 // bandwidth higher than the link rate. 338 // bandwidth higher than the link rate.
339 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited); 339 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited);
340 // The margin here is high, because the aggregation greatly increases 340 // The margin here is high, because the aggregation greatly increases
341 // smoothed rtt. 341 // smoothed rtt.
342 EXPECT_GE(kTestRtt * 4, rtt_stats_->smoothed_rtt()); 342 EXPECT_GE(kTestRtt * 4, rtt_stats_->smoothed_rtt());
343 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f); 343 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f);
344 } 344 }
345 345
346 TEST_F(BbrSenderTest, SimpleTransfer2RTTAggregationKeepSending) {
347 FLAGS_quic_reloadable_flag_quic_bbr_ack_spacing2 = false;
348 FLAGS_quic_reloadable_flag_quic_bbr_ack_aggregation_bytes = false;
349 FLAGS_quic_reloadable_flag_quic_bbr_add_tso_cwnd = false;
350 FLAGS_quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate = true;
351 CreateDefaultSetup();
352 // 2 RTTs of aggregation, with a max of 10kb.
353 EnableAggregation(10 * 1024, 2 * kTestRtt);
354
355 // Transfer 12MB.
356 DoSimpleTransfer(12 * 1024 * 1024, QuicTime::Delta::FromSeconds(35));
357 EXPECT_EQ(BbrSender::PROBE_BW, sender_->ExportDebugState().mode);
358 // It's possible to read a bandwidth as much as 50% too high with aggregation.
359 EXPECT_LE(kTestLinkBandwidth * 0.99f,
360 sender_->ExportDebugState().max_bandwidth);
361 // TODO(ianswett): Tighten this bound once we understand why BBR is
362 // overestimating bandwidth with aggregation. b/36022633
363 EXPECT_GE(kTestLinkBandwidth * 1.5f,
364 sender_->ExportDebugState().max_bandwidth);
365 // TODO(ianswett): Expect 0 packets are lost once BBR no longer measures
366 // bandwidth higher than the link rate.
367 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited);
368 // The margin here is high, because the aggregation greatly increases
369 // smoothed rtt.
370 EXPECT_GE(kTestRtt * 4, rtt_stats_->smoothed_rtt());
371 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f);
372 }
373
346 // Test a simple long data transfer with 2 rtts of aggregation. 374 // Test a simple long data transfer with 2 rtts of aggregation.
347 TEST_F(BbrSenderTest, SimpleTransferAckDecimation) { 375 TEST_F(BbrSenderTest, SimpleTransferAckDecimation) {
348 FLAGS_quic_reloadable_flag_quic_bbr_ack_spacing2 = false; 376 FLAGS_quic_reloadable_flag_quic_bbr_ack_spacing2 = false;
349 FLAGS_quic_reloadable_flag_quic_bbr_ack_aggregation_bytes = true; 377 FLAGS_quic_reloadable_flag_quic_bbr_ack_aggregation_bytes = true;
350 // Decrease the CWND gain so extra CWND is required with stretch acks. 378 // Decrease the CWND gain so extra CWND is required with stretch acks.
351 base::SetFlag(&FLAGS_quic_bbr_cwnd_gain, 1.0); 379 base::SetFlag(&FLAGS_quic_bbr_cwnd_gain, 1.0);
352 sender_ = new BbrSender( 380 sender_ = new BbrSender(
353 rtt_stats_, 381 rtt_stats_,
354 QuicSentPacketManagerPeer::GetUnackedPacketMap( 382 QuicSentPacketManagerPeer::GetUnackedPacketMap(
355 QuicConnectionPeer::GetSentPacketManager(bbr_sender_.connection())), 383 QuicConnectionPeer::GetSentPacketManager(bbr_sender_.connection())),
(...skipping 17 matching lines...) Expand all
373 sender_->ExportDebugState().max_bandwidth); 401 sender_->ExportDebugState().max_bandwidth);
374 // TODO(ianswett): Expect 0 packets are lost once BBR no longer measures 402 // TODO(ianswett): Expect 0 packets are lost once BBR no longer measures
375 // bandwidth higher than the link rate. 403 // bandwidth higher than the link rate.
376 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited); 404 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited);
377 // The margin here is high, because the aggregation greatly increases 405 // The margin here is high, because the aggregation greatly increases
378 // smoothed rtt. 406 // smoothed rtt.
379 EXPECT_GE(kTestRtt * 2, rtt_stats_->smoothed_rtt()); 407 EXPECT_GE(kTestRtt * 2, rtt_stats_->smoothed_rtt());
380 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f); 408 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f);
381 } 409 }
382 410
411 TEST_F(BbrSenderTest, SimpleTransferAckDecimationKeepSending) {
412 FLAGS_quic_reloadable_flag_quic_bbr_ack_spacing2 = false;
413 FLAGS_quic_reloadable_flag_quic_bbr_ack_aggregation_bytes = false;
414 FLAGS_quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate = true;
415 // Decrease the CWND gain so extra CWND is required with stretch acks.
416 base::SetFlag(&FLAGS_quic_bbr_cwnd_gain, 1.0);
417 sender_ = new BbrSender(
418 rtt_stats_,
419 QuicSentPacketManagerPeer::GetUnackedPacketMap(
420 QuicConnectionPeer::GetSentPacketManager(bbr_sender_.connection())),
421 kInitialCongestionWindowPackets, kDefaultMaxCongestionWindowPackets,
422 &random_);
423 QuicConnectionPeer::SetSendAlgorithm(bbr_sender_.connection(), sender_);
424 // Enable Ack Decimation on the receiver.
425 QuicConnectionPeer::SetAckMode(receiver_.connection(),
426 QuicConnection::AckMode::ACK_DECIMATION);
427 CreateDefaultSetup();
428
429 // Transfer 12MB.
430 DoSimpleTransfer(12 * 1024 * 1024, QuicTime::Delta::FromSeconds(35));
431 EXPECT_EQ(BbrSender::PROBE_BW, sender_->ExportDebugState().mode);
432 // It's possible to read a bandwidth as much as 50% too high with aggregation.
433 EXPECT_LE(kTestLinkBandwidth * 0.99f,
434 sender_->ExportDebugState().max_bandwidth);
435 // TODO(ianswett): Tighten this bound once we understand why BBR is
436 // overestimating bandwidth with aggregation. b/36022633
437 EXPECT_GE(kTestLinkBandwidth * 1.5f,
438 sender_->ExportDebugState().max_bandwidth);
439 // TODO(ianswett): Expect 0 packets are lost once BBR no longer measures
440 // bandwidth higher than the link rate.
441 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited);
442 // The margin here is high, because the aggregation greatly increases
443 // smoothed rtt.
444 EXPECT_GE(kTestRtt * 2, rtt_stats_->smoothed_rtt());
445 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f);
446 }
447
383 // Test the number of losses incurred by the startup phase in a situation when 448 // Test the number of losses incurred by the startup phase in a situation when
384 // the buffer is less than BDP. 449 // the buffer is less than BDP.
385 TEST_F(BbrSenderTest, PacketLossOnSmallBufferStartup) { 450 TEST_F(BbrSenderTest, PacketLossOnSmallBufferStartup) {
386 CreateSmallBufferSetup(); 451 CreateSmallBufferSetup();
387 452
388 DriveOutOfStartup(); 453 DriveOutOfStartup();
389 float loss_rate = 454 float loss_rate =
390 static_cast<float>(bbr_sender_.connection()->GetStats().packets_lost) / 455 static_cast<float>(bbr_sender_.connection()->GetStats().packets_lost) /
391 bbr_sender_.connection()->GetStats().packets_sent; 456 bbr_sender_.connection()->GetStats().packets_sent;
392 EXPECT_LE(loss_rate, 0.27); 457 EXPECT_LE(loss_rate, 0.27);
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 sender_->ResumeConnectionState(params, false); 789 sender_->ResumeConnectionState(params, false);
725 EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth); 790 EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth);
726 EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate()); 791 EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate());
727 ExpectApproxEq(kTestRtt, sender_->ExportDebugState().min_rtt, 0.01f); 792 ExpectApproxEq(kTestRtt, sender_->ExportDebugState().min_rtt, 0.01f);
728 793
729 DriveOutOfStartup(); 794 DriveOutOfStartup();
730 } 795 }
731 796
732 } // namespace test 797 } // namespace test
733 } // namespace net 798 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/congestion_control/bbr_sender.cc ('k') | net/quic/core/quic_flags_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698