Bug 1084645 - Enable DNS TTL by default on Windows r=mcmanus
authorSteve Workman <sworkman@mozilla.com>
Mon, 20 Oct 2014 10:26:33 -0700
changeset 211350 b1c4aac68d3c
parent 211349 73b167114b73
child 211351 52b2e7d0c652
push id27673
push userkwierso@gmail.com
push dateTue, 21 Oct 2014 01:57:45 +0000
treeherdermozilla-central@29fbfc1b31aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1084645
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1084645 - Enable DNS TTL by default on Windows r=mcmanus
modules/libpref/init/all.js
netwerk/dns/nsHostResolver.cpp
netwerk/dns/nsHostResolver.h
toolkit/components/telemetry/Histograms.json
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1488,16 +1488,19 @@ pref("network.dns.ipv4OnlyDomains", "");
 pref("network.dns.disableIPv6", false);
 
 // This is the number of dns cache entries allowed
 pref("network.dnsCacheEntries", 400);
 
 // In the absence of OS TTLs, the DNS cache TTL value
 pref("network.dnsCacheExpiration", 60);
 
+// Get TTL; not supported on all platforms; nop on the unsupported ones.
+pref("network.dns.get-ttl", true);
+
 // The grace period allows the DNS cache to use expired entries, while kicking off
 // a revalidation in the background.
 pref("network.dnsCacheExpirationGracePeriod", 60);
 
 // This preference can be used to turn off DNS prefetch.
 pref("network.dns.disablePrefetch", false);
 
 // This preference controls whether or not URLs with UTF-8 characters are
@@ -4346,19 +4349,12 @@ pref("dom.fetch.enabled", false);
 // supported will be disabled. This threshold can be adjusted to suit other
 // platforms; and set to 0 to disable the low-memory check altogether.
 pref("camera.control.low_memory_thresholdMB", 404);
 #endif
 
 // UDPSocket API
 pref("dom.udpsocket.enabled", false);
 
-// Experiment: Get TTL from DNS records.
-//     Unset initially (0); Randomly chosen on first run; will remain unchanged
-//     unless adjusted by the user or experiment ends. Variants defined in
-//     nsHostResolver.cpp.
-pref("dns.ttl-experiment.variant", 0);
-pref("dns.ttl-experiment.enabled", true);
-
 // Use raw ICU instead of CoreServices API in Unicode collation
 #ifdef XP_MACOSX
 pref("intl.collation.mac.use_icu", true);
 #endif
--- a/netwerk/dns/nsHostResolver.cpp
+++ b/netwerk/dns/nsHostResolver.cpp
@@ -149,169 +149,16 @@ IsMediumPriority(uint16_t flags)
 
 static inline bool
 IsLowPriority(uint16_t flags)
 {
     return flags & nsHostResolver::RES_PRIORITY_LOW;
 }
 
 //----------------------------------------------------------------------------
-
-enum DnsExpirationVariant {
-    DNS_EXP_VARIANT_UNSET = 0,
-    DNS_EXP_VARIANT_CONTROL = 1,
-    DNS_EXP_VARIANT_TTL_ONLY = 2,
-    DNS_EXP_VARIANT_TTL_PLUS_CONST_GRACE = 3,
-    DNS_EXP_VARIANT_MAX_VALUE = 3,
-};
-static DnsExpirationVariant sDnsVariant;
-
-static mozilla::Telemetry::ID
-GetCacheHitHistogram(DnsExpirationVariant aVariant,
-                     nsHostRecord::DnsPriority aPriority)
-{
-    using namespace mozilla::Telemetry;
-
-    switch (aVariant) {
-        case DNS_EXP_VARIANT_CONTROL:
-            switch (aPriority) {
-                case nsHostRecord::DNS_PRIORITY_HIGH:
-                    return DNS_CACHE_HIT_VAR_CONTROL_HIGH;
-
-                case nsHostRecord::DNS_PRIORITY_MEDIUM:
-                    return DNS_CACHE_HIT_VAR_CONTROL_MEDIUM;
-
-                case nsHostRecord::DNS_PRIORITY_LOW:
-                    return DNS_CACHE_HIT_VAR_CONTROL_LOW;
-            }
-
-        case DNS_EXP_VARIANT_TTL_ONLY:
-            switch (aPriority) {
-                case nsHostRecord::DNS_PRIORITY_HIGH:
-                    return DNS_CACHE_HIT_VAR_TTL_ONLY_HIGH;
-
-                case nsHostRecord::DNS_PRIORITY_MEDIUM:
-                    return DNS_CACHE_HIT_VAR_TTL_ONLY_MEDIUM;
-
-                case nsHostRecord::DNS_PRIORITY_LOW:
-                    return DNS_CACHE_HIT_VAR_TTL_ONLY_LOW;
-            }
-
-        case DNS_EXP_VARIANT_TTL_PLUS_CONST_GRACE:
-            switch (aPriority) {
-                case nsHostRecord::DNS_PRIORITY_HIGH:
-                    return DNS_CACHE_HIT_VAR_TTL_PLUS_CONST_GRACE_HIGH;
-
-                case nsHostRecord::DNS_PRIORITY_MEDIUM:
-                    return DNS_CACHE_HIT_VAR_TTL_PLUS_CONST_GRACE_MEDIUM;
-
-                case nsHostRecord::DNS_PRIORITY_LOW:
-                    return DNS_CACHE_HIT_VAR_TTL_PLUS_CONST_GRACE_LOW;
-            }
-
-        case DNS_EXP_VARIANT_UNSET:
-            ;
-    }
-
-    MOZ_ASSERT_UNREACHABLE("Invalid expiration variant.");
-    return DNS_CACHE_HIT_VAR_CONTROL_LOW;
-}
-
-static mozilla::Telemetry::ID
-GetBlacklistCountHistogram(DnsExpirationVariant aVariant,
-                           nsHostRecord::DnsPriority aPriority)
-{
-    using namespace mozilla::Telemetry;
-
-    switch (aVariant) {
-        case DNS_EXP_VARIANT_CONTROL:
-            switch (aPriority) {
-                case nsHostRecord::DNS_PRIORITY_HIGH:
-                    return DNS_BLACKLIST_COUNT_VAR_CONTROL_HIGH;
-
-                case nsHostRecord::DNS_PRIORITY_MEDIUM:
-                    return DNS_BLACKLIST_COUNT_VAR_CONTROL_MEDIUM;
-
-                case nsHostRecord::DNS_PRIORITY_LOW:
-                    return DNS_BLACKLIST_COUNT_VAR_CONTROL_LOW;
-            }
-
-        case DNS_EXP_VARIANT_TTL_ONLY:
-            switch (aPriority) {
-                case nsHostRecord::DNS_PRIORITY_HIGH:
-                    return DNS_BLACKLIST_COUNT_VAR_TTL_ONLY_HIGH;
-
-                case nsHostRecord::DNS_PRIORITY_MEDIUM:
-                    return DNS_BLACKLIST_COUNT_VAR_TTL_ONLY_MEDIUM;
-
-                case nsHostRecord::DNS_PRIORITY_LOW:
-                    return DNS_BLACKLIST_COUNT_VAR_TTL_ONLY_LOW;
-            }
-
-        case DNS_EXP_VARIANT_TTL_PLUS_CONST_GRACE:
-            switch (aPriority) {
-                case nsHostRecord::DNS_PRIORITY_HIGH:
-                    return DNS_BLACKLIST_COUNT_VAR_TTL_PLUS_CONST_GRACE_HIGH;
-
-                case nsHostRecord::DNS_PRIORITY_MEDIUM:
-                    return DNS_BLACKLIST_COUNT_VAR_TTL_PLUS_CONST_GRACE_MEDIUM;
-
-                case nsHostRecord::DNS_PRIORITY_LOW:
-                    return DNS_BLACKLIST_COUNT_VAR_TTL_PLUS_CONST_GRACE_LOW;
-            }
-
-        case DNS_EXP_VARIANT_UNSET:
-            ; // Fall through
-    }
-
-    MOZ_ASSERT_UNREACHABLE("Invalid variant.");
-    return DNS_BLACKLIST_COUNT_VAR_CONTROL_LOW;
-}
-
-static mozilla::Telemetry::ID
-GetRenewalTimeHistogram(DnsExpirationVariant aVariant)
-{
-    using namespace mozilla::Telemetry;
-
-#ifdef TTL_AVAILABLE
-    switch (sDnsVariant) {
-        case DNS_EXP_VARIANT_CONTROL:
-            return DNS_RENEWAL_TIME;
-        case DNS_EXP_VARIANT_TTL_ONLY:
-            return DNS_RENEWAL_TIME__TTL_ONLY_EXPT;
-        case DNS_EXP_VARIANT_TTL_PLUS_CONST_GRACE:
-            return DNS_RENEWAL_TIME__TTL_PLUS_CONST_GRACE_EXPT;
-        default:
-            MOZ_ASSERT_UNREACHABLE("Invalid variant.");
-    }
-#endif
-    return DNS_RENEWAL_TIME;
-}
-
-static mozilla::Telemetry::ID
-GetRenewalTimeForTTLHistogram(DnsExpirationVariant aVariant)
-{
-    using namespace mozilla::Telemetry;
-
-#ifdef TTL_AVAILABLE
-    switch (sDnsVariant) {
-        case DNS_EXP_VARIANT_CONTROL:
-            MOZ_ASSERT_UNREACHABLE("No TTL for Control Expt.");
-            return DNS_RENEWAL_TIME;
-        case DNS_EXP_VARIANT_TTL_ONLY:
-            return DNS_RENEWAL_TIME_FOR_TTL__TTL_ONLY_EXPT;
-        case DNS_EXP_VARIANT_TTL_PLUS_CONST_GRACE:
-            return DNS_RENEWAL_TIME_FOR_TTL__TTL_PLUS_CONST_GRACE_EXPT;
-        default:
-            MOZ_ASSERT_UNREACHABLE("Invalid variant.");
-    }
-#endif
-    return DNS_RENEWAL_TIME;
-}
-
 // this macro filters out any flags that are not used when constructing the
 // host key.  the significant flags are those that would affect the resulting
 // host record (i.e., the flags that are passed down to PR_GetAddrInfoByName).
 #define RES_KEY_FLAGS(_f) ((_f) & nsHostResolver::RES_CANON_NAME)
 
 nsHostRecord::nsHostRecord(const nsHostKey *key)
     : addr_info_lock("nsHostRecord.addr_info_lock")
     , addr_info_gencnt(0)
@@ -359,20 +206,17 @@ nsHostRecord::SetExpiration(const mozill
 {
     mValidStart = now;
     mGraceStart = now + TimeDuration::FromSeconds(valid);
     mValidEnd = now + TimeDuration::FromSeconds(valid + grace);
 }
 
 nsHostRecord::~nsHostRecord()
 {
-    Telemetry::Accumulate(
-        GetBlacklistCountHistogram(sDnsVariant,
-                                   nsHostRecord::GetPriority(flags)),
-        mBlacklistedCount);
+    Telemetry::Accumulate(Telemetry::DNS_BLACKLIST_COUNT, mBlacklistedCount);
     delete addr_info;
     delete addr;
 }
 
 bool
 nsHostRecord::Blacklisted(NetAddr *aQuery)
 {
     // must call locked
@@ -651,83 +495,33 @@ HostDB_PruneEntry(PLDHashTable *table,
         return PL_DHASH_REMOVE;
     }
     return PL_DHASH_NEXT;
 }
 
 //----------------------------------------------------------------------------
 
 #if TTL_AVAILABLE
-static const char kTtlExperiment[] = "dns.ttl-experiment.";
-static const char kTtlExperimentEnabled[] = "dns.ttl-experiment.enabled";
-static const char kNetworkExperimentsEnabled[] = "network.allow-experiments";
-static const char kTtlExperimentVariant[] = "dns.ttl-experiment.variant";
-
-void
-nsHostResolver::DnsExperimentChangedInternal()
-{
-    MOZ_ASSERT(NS_IsMainThread(), "Can only get prefs on main thread!");
-
-    if (!Preferences::GetBool(kTtlExperimentEnabled) ||
-            !Preferences::GetBool(kNetworkExperimentsEnabled)) {
-        sDnsVariant = DNS_EXP_VARIANT_CONTROL;
-        LOG(("DNS TTL experiment is disabled."));
-        return;
-    }
-
-    auto variant = static_cast<DnsExpirationVariant>(
-        Preferences::GetInt(kTtlExperimentVariant));
+static const char kPrefGetTtl[] = "network.dns.get-ttl";
+static bool sGetTtlEnabled = false;
 
-    // Setup this profile to use a particular DNS expiration strategy
-    if (variant == DNS_EXP_VARIANT_UNSET) {
-        variant = static_cast<DnsExpirationVariant>(
-            rand() % DNS_EXP_VARIANT_MAX_VALUE + 1);
-        LOG(("No DNS TTL experiment variant saved. Randomly picked %d.",
-             variant));
-
-        DebugOnly<nsresult> rv = Preferences::SetInt(
-            kTtlExperimentVariant, variant);
-        NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
-                         "Could not set experiment variant pref.");
-    } else {
-        LOG(("Using saved DNS TTL experiment %d.", variant));
-    }
-
-    sDnsVariant = variant;
-}
-
-void
-nsHostResolver::DnsExperimentChanged(const char* aPref, void* aClosure)
+static void DnsPrefChanged(const char* aPref, void* aClosure)
 {
     MOZ_ASSERT(NS_IsMainThread(),
                "Should be getting pref changed notification on main thread!");
 
-    if (strcmp(aPref, kNetworkExperimentsEnabled) != 0 &&
-        strncmp(aPref, kTtlExperiment, strlen(kTtlExperiment)) != 0) {
-        LOG(("DnsExperimentChanged ignoring pref \"%s\"", aPref));
+    if (strcmp(aPref, kPrefGetTtl) != 0) {
+        LOG(("DnsPrefChanged ignoring pref \"%s\"", aPref));
         return;
     }
 
     auto self = static_cast<nsHostResolver*>(aClosure);
     MOZ_ASSERT(self);
 
-    // We can't set a pref in the context of a pref change callback, so
-    // dispatch DnsExperimentChangedInternal for async getting/setting.
-    DebugOnly<nsresult> rv = NS_DispatchToMainThread(
-        NS_NewRunnableMethod(self, &nsHostResolver::DnsExperimentChangedInternal));
-    NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
-                     "Could not dispatch DnsExperimentChanged event.");
-}
-
-void
-nsHostResolver::InitCRandom()
-{
-    MOZ_ASSERT(NS_IsMainThread(), "Should be seeding rand() on main thread!");
-
-    srand(time(nullptr));
+    sGetTtlEnabled = Preferences::GetBool(kPrefGetTtl);
 }
 #endif
 
 nsHostResolver::nsHostResolver(uint32_t maxCacheEntries,
                                uint32_t defaultCacheEntryLifetime,
                                uint32_t defaultGracePeriod)
     : mMaxCacheEntries(maxCacheEntries)
     , mDefaultCacheLifetime(defaultCacheEntryLifetime)
@@ -762,36 +556,26 @@ nsHostResolver::Init()
     if (NS_FAILED(GetAddrInfoInit())) {
         return NS_ERROR_FAILURE;
     }
 
     PL_DHashTableInit(&mDB, &gHostDB_ops, nullptr, sizeof(nsHostDBEnt), 0);
 
     mShutdown = false;
 
-    sDnsVariant = DNS_EXP_VARIANT_CONTROL;
-
 #if TTL_AVAILABLE
     // The preferences probably haven't been loaded from the disk yet, so we
     // need to register a callback that will set up the experiment once they
     // are. We also need to explicitly set a value for the props otherwise the
     // callback won't be called.
     {
-        DebugOnly<nsresult> rv = NS_DispatchToMainThread(
-            NS_NewRunnableMethod(this, &nsHostResolver::InitCRandom));
+        DebugOnly<nsresult> rv = Preferences::RegisterCallbackAndCall(
+            &DnsPrefChanged, kPrefGetTtl, this);
         NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
-                         "Could not dispatch InitCRandom event.");
-        rv = Preferences::RegisterCallbackAndCall(
-            &DnsExperimentChanged, kTtlExperiment, this);
-        NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
-                         "Could not register DNS experiment callback.");
-        rv = Preferences::RegisterCallback(
-            &DnsExperimentChanged, kNetworkExperimentsEnabled, this);
-        NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
-                         "Could not register network experiment callback.");
+                         "Could not register DNS TTL pref callback.");
     }
 #endif
 
 #if defined(HAVE_RES_NINIT)
     // We want to make sure the system is using the correct resolver settings,
     // so we force it to reload those settings whenever we startup a subsequent
     // nsHostResolver instance.  We assume that there is no reason to do this
     // for the first nsHostResolver instance since that is usually created
@@ -855,23 +639,19 @@ nsHostResolver::FlushCache()
 void
 nsHostResolver::Shutdown()
 {
     LOG(("Shutting down host resolver.\n"));
 
 #if TTL_AVAILABLE
     {
         DebugOnly<nsresult> rv = Preferences::UnregisterCallback(
-            &DnsExperimentChanged, kTtlExperiment, this);
+            &DnsPrefChanged, kPrefGetTtl, this);
         NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
-                         "Could not unregister TTL experiment callback.");
-        rv = Preferences::UnregisterCallback(
-            &DnsExperimentChanged, kNetworkExperimentsEnabled, this);
-        NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
-                         "Could not unregister network experiment callback.");
+                         "Could not unregister DNS TTL pref callback.");
     }
 #endif
 
     PRCList pendingQHigh, pendingQMed, pendingQLow, evictionQ;
     PR_INIT_CLIST(&pendingQHigh);
     PR_INIT_CLIST(&pendingQMed);
     PR_INIT_CLIST(&pendingQLow);
     PR_INIT_CLIST(&evictionQ);
@@ -1159,19 +939,16 @@ nsHostResolver::ResolveHost(const char  
                 }
             }
         }
     }
     if (result) {
         callback->OnLookupComplete(this, result, status);
     }
 
-    Telemetry::Accumulate(
-        GetCacheHitHistogram(sDnsVariant, nsHostRecord::GetPriority(flags)),
-        static_cast<bool>(result));
     return rv;
 }
 
 void
 nsHostResolver::DetachCallback(const char            *host,
                                uint16_t               flags,
                                uint16_t               af,
                                nsResolveHostCallback *callback,
@@ -1324,17 +1101,17 @@ nsHostResolver::GetHostToLookup(nsHostRe
     timeout = (mNumIdleThreads >= HighThreadThreshold) ? mShortIdleTimeout : mLongIdleTimeout;
     epoch = PR_IntervalNow();
 
     while (!mShutdown) {
         // remove next record from Q; hand over owning reference. Check high, then med, then low
         
 #if TTL_AVAILABLE
         #define SET_GET_TTL(var, val) \
-            (var)->mGetTtl = sDnsVariant != DNS_EXP_VARIANT_CONTROL && (val)
+            (var)->mGetTtl = sGetTtlEnabled && (val)
 #else
         #define SET_GET_TTL(var, val)
 #endif
 
         if (!PR_CLIST_IS_EMPTY(&mHighQ)) {
             DeQueue (mHighQ, result);
             SET_GET_TTL(*result, false);
             return true;
@@ -1397,49 +1174,33 @@ nsHostResolver::PrepareRecordExpiration(
     if (!rec->addr_info) {
         rec->SetExpiration(TimeStamp::NowLoRes(),
                            NEGATIVE_RECORD_LIFETIME, 0);
         LOG(("Caching [%s] negative record for %u seconds.\n", rec->host,
              NEGATIVE_RECORD_LIFETIME));
         return;
     }
 
-    unsigned int ttl = mDefaultCacheLifetime;
+    unsigned int lifetime = mDefaultCacheLifetime;
+    unsigned int grace = mDefaultGracePeriod;
 #if TTL_AVAILABLE
-    if (sDnsVariant == DNS_EXP_VARIANT_TTL_ONLY
-            || sDnsVariant == DNS_EXP_VARIANT_TTL_PLUS_CONST_GRACE) {
+    unsigned int ttl = mDefaultCacheLifetime;
+    if (sGetTtlEnabled) {
         MutexAutoLock lock(rec->addr_info_lock);
         if (rec->addr_info && rec->addr_info->ttl != AddrInfo::NO_TTL_DATA) {
             ttl = rec->addr_info->ttl;
         }
+        lifetime = ttl;
+        grace = 0;
     }
 #endif
 
-    unsigned int lifetime = 0;
-    unsigned int grace = 0;
-    switch (sDnsVariant) {
-        case DNS_EXP_VARIANT_TTL_ONLY:
-            lifetime = ttl;
-            grace = 0;
-            break;
-
-        case DNS_EXP_VARIANT_TTL_PLUS_CONST_GRACE:
-            lifetime = ttl;
-            grace = mDefaultGracePeriod;
-            break;
-
-        default:
-            lifetime = mDefaultCacheLifetime;
-            grace = mDefaultGracePeriod;
-            break;
-    }
-
     rec->SetExpiration(TimeStamp::NowLoRes(), lifetime, grace);
-    LOG(("Caching [%s] record for %u seconds (grace %d) (sDnsVariant = %d).",
-         rec->host, lifetime, grace, sDnsVariant));
+    LOG(("Caching [%s] record for %u seconds (grace %d).",
+         rec->host, lifetime, grace));
 }
 
 //
 // OnLookupComplete() checks if the resolving should be redone and if so it
 // returns LOOKUP_RESOLVEAGAIN, but only if 'status' is not NS_ERROR_ABORT.
 //
 
 nsHostResolver::LookupStatus
@@ -1499,18 +1260,17 @@ nsHostResolver::OnLookupComplete(nsHostR
                     Telemetry::Accumulate(Telemetry::DNS_CLEANUP_AGE,
                                           static_cast<uint32_t>(age.ToSeconds() / 60));
                 }
 
                 // release reference to rec owned by mEvictionQ
                 NS_RELEASE(head);
             }
 #if TTL_AVAILABLE
-            if (!rec->mGetTtl && sDnsVariant != DNS_EXP_VARIANT_CONTROL
-                && !rec->resolving) {
+            if (!rec->mGetTtl && !rec->resolving && sGetTtlEnabled) {
                 LOG(("Issuing second async lookup for TTL for %s.", rec->host));
                 rec->flags =
                   (rec->flags & ~RES_PRIORITY_MEDIUM) | RES_PRIORITY_LOW;
                 DebugOnly<nsresult> rv = IssueLookup(rec);
                 NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
                                  "Could not issue second async lookup for TTL.");
             }
 #endif
@@ -1652,20 +1412,20 @@ nsHostResolver::ThreadFunc(void *arg)
 
         if (NS_SUCCEEDED(status)) {
             Telemetry::ID histogramID;
             if (!rec->addr_info_gencnt) {
                 // Time for initial lookup.
                 histogramID = Telemetry::DNS_LOOKUP_TIME;
             } else if (!getTtl) {
                 // Time for renewal; categorized by expiration strategy.
-                histogramID = GetRenewalTimeHistogram(sDnsVariant);
+                histogramID = Telemetry::DNS_RENEWAL_TIME;
             } else {
                 // Time to get TTL; categorized by expiration strategy.
-                histogramID = GetRenewalTimeForTTLHistogram(sDnsVariant);
+                histogramID = Telemetry::DNS_RENEWAL_TIME_FOR_TTL;
             }
             Telemetry::Accumulate(histogramID, millis);
         } else {
             Telemetry::Accumulate(Telemetry::DNS_FAILED_LOOKUP_TIME, millis);
         }
 
         // OnLookupComplete may release "rec", long before we lose it.
         LOG(("DNS lookup thread - lookup completed for host [%s]: %s.\n",
--- a/netwerk/dns/nsHostResolver.h
+++ b/netwerk/dns/nsHostResolver.h
@@ -310,32 +310,16 @@ private:
     void     ClearPendingQueue(PRCList *aPendingQueue);
     nsresult ConditionallyCreateThread(nsHostRecord *rec);
 
     /**
      * Starts a new lookup in the background for entries that are in the grace
      * period with a failed connect or all cached entries are negative.
      */
     nsresult ConditionallyRefreshRecord(nsHostRecord *rec, const char *host);
-    
-#if TTL_AVAILABLE
-    // For DNS TTL Experiments.
-
-    // Internal function which initializes the TTL experiment pref to a random
-    // value corresponding to one of the TTL experiment variants. To be
-    // dispatched by DnsExperimentChanged to the main thread, since setting
-    // prefs can't be done in the context of a "pref changed" callback.
-    void DnsExperimentChangedInternal();
-
-    // Callback to be registered with Preferences::RegisterCallback.
-    static void DnsExperimentChanged(const char* aPref, void* aClosure);
-
-    // Dispatched to the main thread to ensure that rand is seeded.
-    void InitCRandom();
-#endif
 
     static void  MoveQueue(nsHostRecord *aRec, PRCList &aDestQ);
     
     static void ThreadFunc(void *);
 
     enum {
         METHOD_HIT = 1,
         METHOD_RENEWAL = 2,
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -2148,163 +2148,30 @@
   "DNS_RENEWAL_TIME_FOR_TTL": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": "60000",
     "n_buckets": 50,
     "extended_statistics_ok": true,
     "description": "Time for a DNS OS resolution (msec) used to get TTL"
   },
-  "DNS_RENEWAL_TIME_FOR_TTL__TTL_ONLY_EXPT": {
-    "expires_in_version": "never",
-    "kind": "exponential",
-    "high": "60000",
-    "n_buckets": 50,
-    "extended_statistics_ok": true,
-    "description": "Time for a DNS OS resolution (msec) used to get TTL - TTL Only Experiment"
-  },
-  "DNS_RENEWAL_TIME_FOR_TTL__TTL_PLUS_CONST_GRACE_EXPT": {
-    "expires_in_version": "never",
-    "kind": "exponential",
-    "high": "60000",
-    "n_buckets": 50,
-    "extended_statistics_ok": true,
-    "description": "Time for a DNS OS resolution (msec) used to get TTL - TTL + Const Grace Period Experiment"
-  },
-  "DNS_RENEWAL_TIME__TTL_ONLY_EXPT": {
-    "expires_in_version": "never",
-    "kind": "exponential",
-    "high": "60000",
-    "n_buckets": 50,
-    "extended_statistics_ok": true,
-    "description": "Time for a renewed DNS OS resolution (msec) - TTL Only Experiment"
-  },
-  "DNS_RENEWAL_TIME__TTL_PLUS_CONST_GRACE_EXPT": {
-    "expires_in_version": "never",
-    "kind": "exponential",
-    "high": "60000",
-    "n_buckets": 50,
-    "extended_statistics_ok": true,
-    "description": "Time for a renewed DNS OS resolution (msec) - TTL + Const Grace Period Experiment"
-  },
   "DNS_FAILED_LOOKUP_TIME": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": "60000",
     "n_buckets": 50,
     "extended_statistics_ok": true,
     "description": "Time for an unsuccessful DNS OS resolution (msec)"
   },
-  "DNS_CACHE_HIT_VAR_CONTROL_HIGH": {
-    "expires_in_version": "never",
-    "kind": "boolean",
-    "description": "Whether a cached value was available for a lookup. 0 is a miss, 1 is a hit. (variant: DNS_VARIANT_CONTROL, priority: high)"
-  },
-  "DNS_CACHE_HIT_VAR_CONTROL_MEDIUM": {
-    "expires_in_version": "never",
-    "kind": "boolean",
-    "description": "Whether a cached value was available for a lookup. 0 is a miss, 1 is a hit. (variant: DNS_VARIANT_CONTROL, priority: medium)"
-  },
-  "DNS_CACHE_HIT_VAR_CONTROL_LOW": {
-    "expires_in_version": "never",
-    "kind": "boolean",
-    "description": "Whether a cached value was available for a lookup. 0 is a miss, 1 is a hit. (variant: DNS_VARIANT_CONTROL, priority: low)"
-  },
-  "DNS_CACHE_HIT_VAR_TTL_ONLY_HIGH": {
-    "expires_in_version": "never",
-    "kind": "boolean",
-    "description": "Whether a cached value was available for a lookup. 0 is a miss, 1 is a hit. (variant: DNS_VARIANT_TTL_ONLY, priority: high)"
-  },
-  "DNS_CACHE_HIT_VAR_TTL_ONLY_MEDIUM": {
-    "expires_in_version": "never",
-    "kind": "boolean",
-    "description": "Whether a cached value was available for a lookup. 0 is a miss, 1 is a hit. (variant: DNS_VARIANT_TTL_ONLY, priority: medium)"
-  },
-  "DNS_CACHE_HIT_VAR_TTL_ONLY_LOW": {
-    "expires_in_version": "never",
-    "kind": "boolean",
-    "description": "Whether a cached value was available for a lookup. 0 is a miss, 1 is a hit. (variant: DNS_VARIANT_TTL_ONLY, priority: low)"
-  },
-  "DNS_CACHE_HIT_VAR_TTL_PLUS_CONST_GRACE_HIGH": {
-    "expires_in_version": "never",
-    "kind": "boolean",
-    "description": "Whether a cached value was available for a lookup. 0 is a miss, 1 is a hit. (variant: DNS_VARIANT_TTL_PLUS_CONST_GRACE, priority: high)"
-  },
-  "DNS_CACHE_HIT_VAR_TTL_PLUS_CONST_GRACE_MEDIUM": {
-    "expires_in_version": "never",
-    "kind": "boolean",
-    "description": "Whether a cached value was available for a lookup. 0 is a miss, 1 is a hit. (variant: DNS_VARIANT_TTL_PLUS_CONST_GRACE, priority: medium)"
-  },
-  "DNS_CACHE_HIT_VAR_TTL_PLUS_CONST_GRACE_LOW": {
-    "expires_in_version": "never",
-    "kind": "boolean",
-    "description": "Whether a cached value was available for a lookup. 0 is a miss, 1 is a hit. (variant: DNS_VARIANT_TTL_PLUS_CONST_GRACE, priority: low)"
-  },
-  "DNS_BLACKLIST_COUNT_VAR_CONTROL_HIGH": {
+  "DNS_BLACKLIST_COUNT": {
     "expires_in_version": "never",
     "kind": "linear",
     "high": 21,
     "n_buckets": 20,
-    "description": "The number of unusable addresses reported for each record (variant: DNS_VARIANT_CONTROL, priority: high)"
-  },
-  "DNS_BLACKLIST_COUNT_VAR_CONTROL_MEDIUM": {
-    "expires_in_version": "never",
-    "kind": "linear",
-    "high": 21,
-    "n_buckets": 20,
-    "description": "The number of unusable addresses reported for each record (variant: DNS_VARIANT_CONTROL, priority: medium)"
-  },
-  "DNS_BLACKLIST_COUNT_VAR_CONTROL_LOW": {
-    "expires_in_version": "never",
-    "kind": "linear",
-    "high": 21,
-    "n_buckets": 20,
-    "description": "The number of unusable addresses reported for each record (variant: DNS_VARIANT_CONTROL, priority: low)"
-  },
-  "DNS_BLACKLIST_COUNT_VAR_TTL_ONLY_HIGH": {
-    "expires_in_version": "never",
-    "kind": "linear",
-    "high": 21,
-    "n_buckets": 20,
-    "description": "The number of unusable addresses reported for each record (variant: DNS_VARIANT_TTL_ONLY, priority: high)"
-  },
-  "DNS_BLACKLIST_COUNT_VAR_TTL_ONLY_MEDIUM": {
-    "expires_in_version": "never",
-    "kind": "linear",
-    "high": 21,
-    "n_buckets": 20,
-    "description": "The number of unusable addresses reported for each record (variant: DNS_VARIANT_TTL_ONLY, priority: medium)"
-  },
-  "DNS_BLACKLIST_COUNT_VAR_TTL_ONLY_LOW": {
-    "expires_in_version": "never",
-    "kind": "linear",
-    "high": 21,
-    "n_buckets": 20,
-    "description": "The number of unusable addresses reported for each record (variant: DNS_VARIANT_TTL_ONLY, priority: low)"
-  },
-  "DNS_BLACKLIST_COUNT_VAR_TTL_PLUS_CONST_GRACE_HIGH": {
-    "expires_in_version": "never",
-    "kind": "linear",
-    "high": 21,
-    "n_buckets": 20,
-    "description": "The number of unusable addresses reported for each record (variant: DNS_VARIANT_TTL_PLUS_CONST_GRACE, priority: high)"
-  },
-  "DNS_BLACKLIST_COUNT_VAR_TTL_PLUS_CONST_GRACE_MEDIUM": {
-    "expires_in_version": "never",
-    "kind": "linear",
-    "high": 21,
-    "n_buckets": 20,
-    "description": "The number of unusable addresses reported for each record (variant: DNS_VARIANT_TTL_PLUS_CONST_GRACE, priority: medium)"
-  },
-  "DNS_BLACKLIST_COUNT_VAR_TTL_PLUS_CONST_GRACE_LOW": {
-    "expires_in_version": "never",
-    "kind": "linear",
-    "high": 21,
-    "n_buckets": 20,
-    "description": "The number of unusable addresses reported for each record (variant: DNS_VARIANT_TTL_PLUS_CONST_GRACE, priority: low)"
+    "description": "The number of unusable addresses reported for each record"
   },
   "PREDICTOR_PREDICT_ATTEMPTS": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": "1000 * 1000",
     "n_buckets": 50,
     "extended_statistics_ok": true,
     "description": "Number of times nsINetworkPredictor::Predict is called and attempts to predict"