OLD | NEW |
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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 sender_->ExportDebugState().max_bandwidth); | 412 sender_->ExportDebugState().max_bandwidth); |
413 // TODO(ianswett): Expect 0 packets are lost once BBR no longer measures | 413 // TODO(ianswett): Expect 0 packets are lost once BBR no longer measures |
414 // bandwidth higher than the link rate. | 414 // bandwidth higher than the link rate. |
415 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited); | 415 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited); |
416 // The margin here is high, because the aggregation greatly increases | 416 // The margin here is high, because the aggregation greatly increases |
417 // smoothed rtt. | 417 // smoothed rtt. |
418 EXPECT_GE(kTestRtt * 2, rtt_stats_->smoothed_rtt()); | 418 EXPECT_GE(kTestRtt * 2, rtt_stats_->smoothed_rtt()); |
419 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f); | 419 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f); |
420 } | 420 } |
421 | 421 |
| 422 // Test a simple long data transfer with 2 rtts of aggregation. |
| 423 TEST_F(BbrSenderTest, |
| 424 SimpleTransfer2RTTAggregationBytesWithIncreasedInflightLimit) { |
| 425 FLAGS_quic_reloadable_flag_quic_bbr_ack_aggregation_bytes = false; |
| 426 FLAGS_quic_reloadable_flag_quic_bbr_add_tso_cwnd = false; |
| 427 FLAGS_quic_reloadable_flag_quic_bbr_keep_sending_at_recent_rate = false; |
| 428 FLAGS_quic_reloadable_flag_quic_bbr_slow_recent_delivery = true; |
| 429 SetQuicFlag(&FLAGS_quic_bbr_slow_delivery_threshold_multiplier, 0.5); |
| 430 SetQuicFlag(&FLAGS_quic_bbr_slow_delivery_cwnd_gain, 4.0); |
| 431 CreateDefaultSetup(); |
| 432 // 2 RTTs of aggregation, with a max of 10kb. |
| 433 EnableAggregation(10 * 1024, 2 * kTestRtt); |
| 434 |
| 435 // Transfer 12MB. |
| 436 DoSimpleTransfer(12 * 1024 * 1024, QuicTime::Delta::FromSeconds(35)); |
| 437 EXPECT_EQ(BbrSender::PROBE_BW, sender_->ExportDebugState().mode); |
| 438 // It's possible to read a bandwidth as much as 50% too high with aggregation. |
| 439 EXPECT_LE(kTestLinkBandwidth * 0.99f, |
| 440 sender_->ExportDebugState().max_bandwidth); |
| 441 // TODO(ianswett): Tighten this bound once we understand why BBR is |
| 442 // overestimating bandwidth with aggregation. b/36022633 |
| 443 EXPECT_GE(kTestLinkBandwidth * 1.5f, |
| 444 sender_->ExportDebugState().max_bandwidth); |
| 445 // TODO(ianswett): Expect 0 packets are lost once BBR no longer measures |
| 446 // bandwidth higher than the link rate. |
| 447 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited); |
| 448 // The margin here is high, because the aggregation greatly increases |
| 449 // smoothed rtt. |
| 450 EXPECT_GE(kTestRtt * 4, rtt_stats_->smoothed_rtt()); |
| 451 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f); |
| 452 } |
| 453 |
422 // Test the number of losses incurred by the startup phase in a situation when | 454 // Test the number of losses incurred by the startup phase in a situation when |
423 // the buffer is less than BDP. | 455 // the buffer is less than BDP. |
424 TEST_F(BbrSenderTest, PacketLossOnSmallBufferStartup) { | 456 TEST_F(BbrSenderTest, PacketLossOnSmallBufferStartup) { |
425 CreateSmallBufferSetup(); | 457 CreateSmallBufferSetup(); |
426 | 458 |
427 DriveOutOfStartup(); | 459 DriveOutOfStartup(); |
428 float loss_rate = | 460 float loss_rate = |
429 static_cast<float>(bbr_sender_.connection()->GetStats().packets_lost) / | 461 static_cast<float>(bbr_sender_.connection()->GetStats().packets_lost) / |
430 bbr_sender_.connection()->GetStats().packets_sent; | 462 bbr_sender_.connection()->GetStats().packets_sent; |
431 EXPECT_LE(loss_rate, 0.27); | 463 EXPECT_LE(loss_rate, 0.27); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 sender_->ResumeConnectionState(params, false); | 808 sender_->ResumeConnectionState(params, false); |
777 EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth); | 809 EXPECT_EQ(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth); |
778 EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate()); | 810 EXPECT_EQ(kTestLinkBandwidth, sender_->BandwidthEstimate()); |
779 ExpectApproxEq(kTestRtt, sender_->ExportDebugState().min_rtt, 0.01f); | 811 ExpectApproxEq(kTestRtt, sender_->ExportDebugState().min_rtt, 0.01f); |
780 | 812 |
781 DriveOutOfStartup(); | 813 DriveOutOfStartup(); |
782 } | 814 } |
783 | 815 |
784 } // namespace test | 816 } // namespace test |
785 } // namespace net | 817 } // namespace net |
OLD | NEW |