diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 12e61ee4b534..836f56abe591 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1428,8 +1428,8 @@ pref("network.http.diagnostics", false); pref("network.http.pacing.requests.enabled", true); pref("network.http.pacing.requests.min-parallelism", 6); -pref("network.http.pacing.requests.hz", 100); -pref("network.http.pacing.requests.burst", 32); +pref("network.http.pacing.requests.hz", 80); +pref("network.http.pacing.requests.burst", 10); // TCP Keepalive config for HTTP connections. pref("network.http.tcp_keepalive.short_lived_connections", true); diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index d80c1e89da66..8dd6cf599e2b 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -1748,11 +1748,19 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent, // pacing so it can be found on cancel if necessary. // Transactions that cause blocking or bypass it (e.g. js/css) are not rate // limited. - if (gHttpHandler->UseRequestTokenBucket() && - (mNumActiveConns >= mNumSpdyActiveConns) && // just check for robustness sake - ((mNumActiveConns - mNumSpdyActiveConns) >= gHttpHandler->RequestTokenBucketMinParallelism()) && - !(caps & (NS_HTTP_LOAD_AS_BLOCKING | NS_HTTP_LOAD_UNBLOCKED))) { - if (!trans->TryToRunPacedRequest()) { + if (gHttpHandler->UseRequestTokenBucket()) { + // submit even whitelisted transactions to the token bucket though they will + // not be slowed by it + bool runNow = trans->TryToRunPacedRequest(); + if (!runNow) { + if ((mNumActiveConns - mNumSpdyActiveConns) <= + gHttpHandler->RequestTokenBucketMinParallelism()) { + runNow = true; // white list it + } else if (caps & (NS_HTTP_LOAD_AS_BLOCKING | NS_HTTP_LOAD_UNBLOCKED)) { + runNow = true; // white list it + } + } + if (!runNow) { LOG((" blocked due to rate pacing trans=%p\n", trans)); return NS_ERROR_NOT_AVAILABLE; }