OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/net/predictor_api.h" | 5 #include "chrome/browser/net/predictor_api.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 PredictorInit::PredictorInit(PrefService* user_prefs, | 544 PredictorInit::PredictorInit(PrefService* user_prefs, |
545 PrefService* local_state, | 545 PrefService* local_state, |
546 bool preconnect_enabled) { | 546 bool preconnect_enabled) { |
547 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 547 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
548 // Set up a field trial to see what disabling DNS pre-resolution does to | 548 // Set up a field trial to see what disabling DNS pre-resolution does to |
549 // latency of page loads. | 549 // latency of page loads. |
550 base::FieldTrial::Probability kDivisor = 1000; | 550 base::FieldTrial::Probability kDivisor = 1000; |
551 // For each option (i.e., non-default), we have a fixed probability. | 551 // For each option (i.e., non-default), we have a fixed probability. |
552 base::FieldTrial::Probability kProbabilityPerGroup = 100; // 10% probability. | 552 base::FieldTrial::Probability kProbabilityPerGroup = 100; // 10% probability. |
553 | 553 |
554 trial_ = new base::FieldTrial("DnsImpact", kDivisor); | 554 // After June 30, 2011 builds, it will always be in default group |
| 555 // (default_enabled_prefetch). |
| 556 trial_ = new base::FieldTrial("DnsImpact", kDivisor, |
| 557 "default_enabled_prefetch", 2011, 6, 30); |
555 | 558 |
556 // First option is to disable prefetching completely. | 559 // First option is to disable prefetching completely. |
557 int disabled_prefetch = trial_->AppendGroup("disabled_prefetch", | 560 int disabled_prefetch = trial_->AppendGroup("disabled_prefetch", |
558 kProbabilityPerGroup); | 561 kProbabilityPerGroup); |
559 | 562 |
560 | |
561 // We're running two experiments at the same time. The first set of trials | 563 // We're running two experiments at the same time. The first set of trials |
562 // modulates the delay-time until we declare a congestion event (and purge | 564 // modulates the delay-time until we declare a congestion event (and purge |
563 // our queue). The second modulates the number of concurrent resolutions | 565 // our queue). The second modulates the number of concurrent resolutions |
564 // we do at any time. Users are in exactly one trial (or the default) during | 566 // we do at any time. Users are in exactly one trial (or the default) during |
565 // any one run, and hence only one experiment at a time. | 567 // any one run, and hence only one experiment at a time. |
566 // Experiment 1: | 568 // Experiment 1: |
567 // Set congestion detection at 250, 500, or 750ms, rather than the 1 second | 569 // Set congestion detection at 250, 500, or 750ms, rather than the 1 second |
568 // default. | 570 // default. |
569 int max_250ms_prefetch = trial_->AppendGroup("max_250ms_queue_prefetch", | 571 int max_250ms_prefetch = trial_->AppendGroup("max_250ms_queue_prefetch", |
570 kProbabilityPerGroup); | 572 kProbabilityPerGroup); |
571 int max_500ms_prefetch = trial_->AppendGroup("max_500ms_queue_prefetch", | 573 int max_500ms_prefetch = trial_->AppendGroup("max_500ms_queue_prefetch", |
572 kProbabilityPerGroup); | 574 kProbabilityPerGroup); |
573 int max_750ms_prefetch = trial_->AppendGroup("max_750ms_queue_prefetch", | 575 int max_750ms_prefetch = trial_->AppendGroup("max_750ms_queue_prefetch", |
574 kProbabilityPerGroup); | 576 kProbabilityPerGroup); |
575 // Set congestion detection at 2 seconds instead of the 1 second default. | 577 // Set congestion detection at 2 seconds instead of the 1 second default. |
576 int max_2s_prefetch = trial_->AppendGroup("max_2s_queue_prefetch", | 578 int max_2s_prefetch = trial_->AppendGroup("max_2s_queue_prefetch", |
577 kProbabilityPerGroup); | 579 kProbabilityPerGroup); |
578 // Experiment 2: | 580 // Experiment 2: |
579 // Set max simultaneous resoultions to 2, 4, or 6, and scale the congestion | 581 // Set max simultaneous resoultions to 2, 4, or 6, and scale the congestion |
580 // limit proportionally (so we don't impact average probability of asserting | 582 // limit proportionally (so we don't impact average probability of asserting |
581 // congesion very much). | 583 // congesion very much). |
582 int max_2_concurrent_prefetch = trial_->AppendGroup( | 584 int max_2_concurrent_prefetch = trial_->AppendGroup( |
583 "max_2 concurrent_prefetch", kProbabilityPerGroup); | 585 "max_2 concurrent_prefetch", kProbabilityPerGroup); |
584 int max_4_concurrent_prefetch = trial_->AppendGroup( | 586 int max_4_concurrent_prefetch = trial_->AppendGroup( |
585 "max_4 concurrent_prefetch", kProbabilityPerGroup); | 587 "max_4 concurrent_prefetch", kProbabilityPerGroup); |
586 int max_6_concurrent_prefetch = trial_->AppendGroup( | 588 int max_6_concurrent_prefetch = trial_->AppendGroup( |
587 "max_6 concurrent_prefetch", kProbabilityPerGroup); | 589 "max_6 concurrent_prefetch", kProbabilityPerGroup); |
588 | 590 |
589 trial_->AppendGroup("default_enabled_prefetch", | |
590 base::FieldTrial::kAllRemainingProbability); | |
591 | |
592 // We will register the incognito observer regardless of whether prefetching | 591 // We will register the incognito observer regardless of whether prefetching |
593 // is enabled, as it is also used to clear the host cache. | 592 // is enabled, as it is also used to clear the host cache. |
594 g_off_the_record_observer.Get().Register(); | 593 g_off_the_record_observer.Get().Register(); |
595 | 594 |
596 if (trial_->group() != disabled_prefetch) { | 595 if (trial_->group() != disabled_prefetch) { |
597 // Initialize the DNS prefetch system. | 596 // Initialize the DNS prefetch system. |
598 size_t max_parallel_resolves = kMaxSpeculativeParallelResolves; | 597 size_t max_parallel_resolves = kMaxSpeculativeParallelResolves; |
599 int max_queueing_delay_ms = kMaxSpeculativeResolveQueueDelayMs; | 598 int max_queueing_delay_ms = kMaxSpeculativeResolveQueueDelayMs; |
600 | 599 |
601 if (trial_->group() == max_2_concurrent_prefetch) | 600 if (trial_->group() == max_2_concurrent_prefetch) |
(...skipping 23 matching lines...) Expand all Loading... |
625 DCHECK(!g_predictor); | 624 DCHECK(!g_predictor); |
626 InitNetworkPredictor(max_queueing_delay, max_parallel_resolves, user_prefs, | 625 InitNetworkPredictor(max_queueing_delay, max_parallel_resolves, user_prefs, |
627 local_state, preconnect_enabled); | 626 local_state, preconnect_enabled); |
628 } | 627 } |
629 } | 628 } |
630 | 629 |
631 PredictorInit::~PredictorInit() { | 630 PredictorInit::~PredictorInit() { |
632 } | 631 } |
633 | 632 |
634 } // namespace chrome_browser_net | 633 } // namespace chrome_browser_net |
OLD | NEW |