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

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

Issue 2759203003: Landing Recent QUIC changes until Thu Mar 16 17:24:53 2017 +0000 (Closed)
Patch Set: float Created 3 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/core/congestion_control/bbr_sender.cc ('k') | net/quic/core/quic_data_reader.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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 225
226 DoSimpleTransfer(12 * 1024 * 1024, QuicTime::Delta::FromSeconds(30)); 226 DoSimpleTransfer(12 * 1024 * 1024, QuicTime::Delta::FromSeconds(30));
227 EXPECT_EQ(BbrSender::PROBE_BW, sender_->ExportDebugState().mode); 227 EXPECT_EQ(BbrSender::PROBE_BW, sender_->ExportDebugState().mode);
228 ExpectApproxEq(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth, 228 ExpectApproxEq(kTestLinkBandwidth, sender_->ExportDebugState().max_bandwidth,
229 0.01f); 229 0.01f);
230 EXPECT_GE(bbr_sender_.connection()->GetStats().packets_lost, 0u); 230 EXPECT_GE(bbr_sender_.connection()->GetStats().packets_lost, 0u);
231 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited); 231 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited);
232 } 232 }
233 233
234 // Test a simple long data transfer with 2 rtts of aggregation. 234 // Test a simple long data transfer with 2 rtts of aggregation.
235 TEST_F(BbrSenderTest, DISABLED_SimpleTransfer2RTTAggregation) { 235 TEST_F(BbrSenderTest, SimpleTransfer2RTTAggregation) {
236 QuicFlagSaver flags; 236 QuicFlagSaver flags;
237 FLAGS_quic_reloadable_flag_quic_bbr_ack_spacing2 = true; 237 FLAGS_quic_reloadable_flag_quic_bbr_ack_spacing2 = true;
238 CreateDefaultSetup(); 238 CreateDefaultSetup();
239 // 2 RTTs of aggregation, with a max of 10kb. 239 // 2 RTTs of aggregation, with a max of 10kb.
240 EnableAggregation(10 * 1024, 2 * kTestRtt); 240 EnableAggregation(10 * 1024, 2 * kTestRtt);
241 241
242 // Transfer 12MB. 242 // Transfer 12MB.
243 DoSimpleTransfer(12 * 1024 * 1024, QuicTime::Delta::FromSeconds(35)); 243 DoSimpleTransfer(12 * 1024 * 1024, QuicTime::Delta::FromSeconds(35));
244 EXPECT_EQ(BbrSender::PROBE_BW, sender_->ExportDebugState().mode); 244 EXPECT_EQ(BbrSender::PROBE_BW, sender_->ExportDebugState().mode);
245 // It's possible to read a bandwidth as much as 25% too high with aggregation. 245 // It's possible to read a bandwidth as much as 50% too high with aggregation.
246 EXPECT_LE(kTestLinkBandwidth * 0.99f, 246 EXPECT_LE(kTestLinkBandwidth * 0.99f,
247 sender_->ExportDebugState().max_bandwidth); 247 sender_->ExportDebugState().max_bandwidth);
248 // TODO(ianswett): Tighten this bound once we understand why BBR is 248 // TODO(ianswett): Tighten this bound once we understand why BBR is
249 // overestimating bandwidth with aggregation. b/36022633 249 // overestimating bandwidth with aggregation. b/36022633
250 EXPECT_GE(kTestLinkBandwidth * 1.25f, 250 EXPECT_GE(kTestLinkBandwidth * 1.5f,
251 sender_->ExportDebugState().max_bandwidth);
252 // TODO(ianswett): Expect 0 packets are lost once BBR no longer measures
253 // bandwidth higher than the link rate.
254 // The margin here is high, because the aggregation greatly increases
255 // smoothed rtt.
256 EXPECT_GE(kTestRtt * 4, rtt_stats_->smoothed_rtt());
257 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f);
258 }
259
260 // Test a simple long data transfer with 2 rtts of aggregation.
261 TEST_F(BbrSenderTest, SimpleTransfer2RTTAggregationBytes) {
262 FLAGS_quic_reloadable_flag_quic_bbr_ack_spacing2 = false;
263 FLAGS_quic_reloadable_flag_quic_bbr_ack_aggregation_bytes = true;
264 CreateDefaultSetup();
265 // 2 RTTs of aggregation, with a max of 10kb.
266 EnableAggregation(10 * 1024, 2 * kTestRtt);
267
268 // Transfer 12MB.
269 DoSimpleTransfer(12 * 1024 * 1024, QuicTime::Delta::FromSeconds(35));
270 EXPECT_EQ(BbrSender::PROBE_BW, sender_->ExportDebugState().mode);
271 // It's possible to read a bandwidth as much as 50% too high with aggregation.
272 EXPECT_LE(kTestLinkBandwidth * 0.99f,
273 sender_->ExportDebugState().max_bandwidth);
274 // TODO(ianswett): Tighten this bound once we understand why BBR is
275 // overestimating bandwidth with aggregation. b/36022633
276 EXPECT_GE(kTestLinkBandwidth * 1.5f,
251 sender_->ExportDebugState().max_bandwidth); 277 sender_->ExportDebugState().max_bandwidth);
252 // TODO(ianswett): Expect 0 packets are lost once BBR no longer measures 278 // TODO(ianswett): Expect 0 packets are lost once BBR no longer measures
253 // bandwidth higher than the link rate. 279 // bandwidth higher than the link rate.
254 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited); 280 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited);
281 // The margin here is high, because the aggregation greatly increases
282 // smoothed rtt.
283 EXPECT_GE(kTestRtt * 4, rtt_stats_->smoothed_rtt());
284 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f);
285 }
286
287 // Test a simple long data transfer with 2 rtts of aggregation.
288 TEST_F(BbrSenderTest, SimpleTransferAckDecimation) {
289 FLAGS_quic_reloadable_flag_quic_bbr_ack_spacing2 = false;
290 FLAGS_quic_reloadable_flag_quic_bbr_ack_aggregation_bytes = true;
291 // Decrease the CWND gain so extra CWND is required with stretch acks.
292 base::SetFlag(&FLAGS_quic_bbr_cwnd_gain, 1.0);
293 sender_ = new BbrSender(
294 rtt_stats_,
295 QuicSentPacketManagerPeer::GetUnackedPacketMap(
296 QuicConnectionPeer::GetSentPacketManager(bbr_sender_.connection())),
297 kInitialCongestionWindowPackets, kDefaultMaxCongestionWindowPackets,
298 &random_);
299 QuicConnectionPeer::SetSendAlgorithm(bbr_sender_.connection(), sender_);
300 // Enable Ack Decimation on the receiver.
301 QuicConnectionPeer::SetAckMode(receiver_.connection(),
302 QuicConnection::AckMode::ACK_DECIMATION);
303 CreateDefaultSetup();
304
305 // Transfer 12MB.
306 DoSimpleTransfer(12 * 1024 * 1024, QuicTime::Delta::FromSeconds(35));
307 EXPECT_EQ(BbrSender::PROBE_BW, sender_->ExportDebugState().mode);
308 // It's possible to read a bandwidth as much as 50% too high with aggregation.
309 EXPECT_LE(kTestLinkBandwidth * 0.99f,
310 sender_->ExportDebugState().max_bandwidth);
311 // TODO(ianswett): Tighten this bound once we understand why BBR is
312 // overestimating bandwidth with aggregation. b/36022633
313 EXPECT_GE(kTestLinkBandwidth * 1.5f,
314 sender_->ExportDebugState().max_bandwidth);
315 // TODO(ianswett): Expect 0 packets are lost once BBR no longer measures
316 // bandwidth higher than the link rate.
317 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited);
318 // The margin here is high, because the aggregation greatly increases
319 // smoothed rtt.
320 EXPECT_GE(kTestRtt * 2, rtt_stats_->smoothed_rtt());
321 ExpectApproxEq(kTestRtt, rtt_stats_->min_rtt(), 0.1f);
255 } 322 }
256 323
257 // Test the number of losses incurred by the startup phase in a situation when 324 // Test the number of losses incurred by the startup phase in a situation when
258 // the buffer is less than BDP. 325 // the buffer is less than BDP.
259 TEST_F(BbrSenderTest, PacketLossOnSmallBufferStartup) { 326 TEST_F(BbrSenderTest, PacketLossOnSmallBufferStartup) {
260 CreateSmallBufferSetup(); 327 CreateSmallBufferSetup();
261 328
262 DriveOutOfStartup(); 329 DriveOutOfStartup();
263 float loss_rate = 330 float loss_rate =
264 static_cast<float>(bbr_sender_.connection()->GetStats().packets_lost) / 331 static_cast<float>(bbr_sender_.connection()->GetStats().packets_lost) /
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 ASSERT_TRUE(simulator_result); 619 ASSERT_TRUE(simulator_result);
553 EXPECT_EQ(BbrSender::DRAIN, sender_->ExportDebugState().mode); 620 EXPECT_EQ(BbrSender::DRAIN, sender_->ExportDebugState().mode);
554 EXPECT_EQ(2u, sender_->ExportDebugState().round_trip_count - max_bw_round); 621 EXPECT_EQ(2u, sender_->ExportDebugState().round_trip_count - max_bw_round);
555 EXPECT_EQ(2u, sender_->ExportDebugState().rounds_without_bandwidth_gain); 622 EXPECT_EQ(2u, sender_->ExportDebugState().rounds_without_bandwidth_gain);
556 EXPECT_EQ(0u, bbr_sender_.connection()->GetStats().packets_lost); 623 EXPECT_EQ(0u, bbr_sender_.connection()->GetStats().packets_lost);
557 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited); 624 EXPECT_FALSE(sender_->ExportDebugState().last_sample_is_app_limited);
558 } 625 }
559 626
560 } // namespace test 627 } // namespace test
561 } // namespace net 628 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/congestion_control/bbr_sender.cc ('k') | net/quic/core/quic_data_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698