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

Side by Side Diff: chrome/browser/trials/http_throttling_trial.cc

Issue 7027040: Implement A/B experiment for anti-DDoS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head. Extend trial cut-off date to July 23rd. Created 9 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/trials/http_throttling_trial.h"
6
7 #include "base/metrics/field_trial.h"
8 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/common/pref_names.h"
10
11 void CreateHttpThrottlingTrial(PrefService* prefs) {
12 DCHECK(prefs);
13
14 // We only use one-time randomization, meaning each client will be put
15 // in the same group on every startup, so that users do not have a situation
16 // where they are intermittently in the experiment group, and have problems
17 // because of throttling, then turn off their browser to fix the problem,
18 // come back, and cannot figure out why they had problems (because throttling
19 // will most likely by then be turned off). A lesser concern is that if
20 // we didn't use one-time randomization, users might notice the preference
21 // in about:net-internals toggling from one state to the other.
22 if (!base::FieldTrialList::IsOneTimeRandomizationEnabled())
23 return;
24
25 // Probability for each trial group (the experiment and the control) is 5%.
26 const base::FieldTrial::Probability kEachGroupProbability = 5;
27 const base::FieldTrial::Probability kTotalProbability = 100;
28 // Disable trial a couple of days before M14 branch point.
29 scoped_refptr<base::FieldTrial> trial(new base::FieldTrial(
30 "HttpThrottlingEnabled", kTotalProbability, "Default", 2011, 7, 23));
31 trial->UseOneTimeRandomization();
32
33 // If the user has touched the control for whether throttling is enabled
34 // or not, we only allow the Default group for the trial, and we do not
35 // modify the value of prefs::kHttpThrottlingEnabled.
36 if (prefs->GetBoolean(prefs::kHttpThrottlingMayExperiment)) {
37 int experiment_group =
38 trial->AppendGroup("Experiment", kEachGroupProbability);
39
40 // The behavior for the control group is the same as for the default group.
41 // The point of having the control group is that it's the same size as
42 // the experiment group and selected the same way, so we get an
43 // apples-to-apples comparison of histograms.
44 trial->AppendGroup("Control", kEachGroupProbability);
45
46 prefs->SetBoolean(prefs::kHttpThrottlingEnabled,
47 trial->group() == experiment_group);
48 }
49 }
OLDNEW
« no previous file with comments | « chrome/browser/trials/http_throttling_trial.h ('k') | chrome/browser/ui/webui/net_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698