[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [torbrowser/maint-2.4] Minor tweaks to the pipeline patch.
commit 509711f6478cc906e019143ca3c7f544e00f78c2
Author: Mike Perry <mikeperry-git@xxxxxxxxxx>
Date: Thu Apr 11 12:45:58 2013 -0700
Minor tweaks to the pipeline patch.
We were being too generous by not counting pending requests towards the depth
limit. This caused fairly fixed batching sizes.
---
...ize-HTTP-request-order-and-pipeline-depth.patch | 59 +++++++++++--------
1 files changed, 34 insertions(+), 25 deletions(-)
diff --git a/src/current-patches/firefox/0017-Randomize-HTTP-request-order-and-pipeline-depth.patch b/src/current-patches/firefox/0017-Randomize-HTTP-request-order-and-pipeline-depth.patch
index cb29e76..f7dab44 100644
--- a/src/current-patches/firefox/0017-Randomize-HTTP-request-order-and-pipeline-depth.patch
+++ b/src/current-patches/firefox/0017-Randomize-HTTP-request-order-and-pipeline-depth.patch
@@ -1,4 +1,4 @@
-From 7b340f34e429a4cb3407f838b4d414a671668419 Mon Sep 17 00:00:00 2001
+From 468117ab9f414332429406e588ad81fa7b3c72fa Mon Sep 17 00:00:00 2001
From: Mike Perry <mikeperry-git@xxxxxxxxxxxxxx>
Date: Tue, 4 Dec 2012 17:38:51 -0800
Subject: [PATCH 17/28] Randomize HTTP request order and pipeline depth.
@@ -10,8 +10,8 @@ See:
https://blog.torproject.org/blog/experimental-defense-website-traffic-fingerprinting
This patch is different from the approach described in that post, as well as
-the the 10.x ESR patch, as the pipelining code has changed significantly
-between the time of writing of that post and Firefox 17.
+the 10.x ESR patch, as the pipelining code has changed significantly between
+the time of writing of that post and Firefox 17.
The main control nob for this patch is now the about:config pref
"network.http.pipelining.max-optimistic-requests". The value of that pref
@@ -26,8 +26,8 @@ extremely sensitive to browser performance. In fact, a debug build alone is
enough to significantly impair request availability to the pipeline (due
slower document parsing and rendering). For this reason, we provide two
separate debug log defines. For most evaluation circumstances, you want to
-define only WTF_TEST in an optimized build to only log request order and
-combination behavior.
+define only WTF_TEST in an optimized build to only log request order,
+combination behavior, and cases where the pipeline is forcibly disabled.
This patch may also have some minor impact on SPDY request order, but the SPDY
implementation has not been altered directly. It has several stream queues
@@ -36,15 +36,15 @@ request representation that will allow more requests to be packed inside Tor
cells. If you have interest in evaluating SPDY in a study of Website Traffic
Fingerprinting, please contact me.
---
- netwerk/protocol/http/nsHttpConnectionMgr.cpp | 288 +++++++++++++++++--------
+ netwerk/protocol/http/nsHttpConnectionMgr.cpp | 297 +++++++++++++++++--------
netwerk/protocol/http/nsHttpConnectionMgr.h | 15 +-
netwerk/protocol/http/nsHttpHandler.h | 2 +
netwerk/protocol/http/nsHttpPipeline.cpp | 62 +++++-
netwerk/protocol/http/nsHttpPipeline.h | 3 +
- 5 files changed, 272 insertions(+), 98 deletions(-)
+ 5 files changed, 281 insertions(+), 98 deletions(-)
diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
-index 133c301..872d505 100644
+index 133c301..81ea113 100644
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -20,6 +20,8 @@
@@ -139,7 +139,7 @@ index 133c301..872d505 100644
nsHttpTransaction *trans,
nsHttpTransaction::Classifier classification,
uint16_t depthLimit)
-@@ -1300,40 +1328,92 @@ nsHttpConnectionMgr::AddToShortestPipeline(nsConnectionEntry *ent,
+@@ -1300,40 +1328,100 @@ nsHttpConnectionMgr::AddToShortestPipeline(nsConnectionEntry *ent,
if (maxdepth < 2)
return false;
@@ -199,8 +199,16 @@ index 133c301..872d505 100644
- if (maxdepth <= connLength)
+ totalDepth += pipelineDepth;
+
-+ // Only count in-flight requests towards maxdepth.
-+ if (maxdepth <= (pipelineDepth - requestLen))
++ // If we're within striking distance of our pipeline
++ // packaging goal, give a little slack on the depth
++ // limit to allow us to try to get there. Don't give
++ // too much slack, though, or we'll tend to have
++ // request packages of the same size when we have
++ // many content elements appear.
++ if (maxdepth <=
++ (pipelineDepth -
++ PR_MIN(mMaxOptimisticPipelinedRequests,
++ requestLen + allClasses)))
continue;
- if (!bestConn || (connLength < bestConnLength)) {
@@ -246,7 +254,7 @@ index 133c301..872d505 100644
activeTrans = bestConn->Transaction();
nsresult rv = activeTrans->AddTransaction(trans);
-@@ -1343,6 +1423,14 @@ nsHttpConnectionMgr::AddToShortestPipeline(nsConnectionEntry *ent,
+@@ -1343,6 +1431,14 @@ nsHttpConnectionMgr::AddToShortestPipeline(nsConnectionEntry *ent,
LOG((" scheduling trans %p on pipeline at position %d\n",
trans, trans->PipelinePosition()));
@@ -261,7 +269,7 @@ index 133c301..872d505 100644
if ((ent->PipelineState() == PS_YELLOW) && (trans->PipelinePosition() > 1))
ent->SetYellowConnection(bestConn);
return true;
-@@ -1403,26 +1491,12 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
+@@ -1403,26 +1499,12 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
nsHttpTransaction::Classifier classification = trans->Classification();
uint8_t caps = trans->Caps();
@@ -290,7 +298,7 @@ index 133c301..872d505 100644
// step 0
// look for existing spdy connection - that's always best because it is
// essentially pipelining without head of line blocking
-@@ -1436,20 +1510,27 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
+@@ -1436,20 +1518,27 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
}
}
@@ -330,7 +338,7 @@ index 133c301..872d505 100644
nsRefPtr<nsHttpConnection> conn;
while (!conn && (ent->mIdleConns.Length() > 0)) {
conn = ent->mIdleConns[0];
-@@ -1483,21 +1564,8 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
+@@ -1483,21 +1572,8 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
}
}
@@ -354,7 +362,7 @@ index 133c301..872d505 100644
nsresult rv = MakeNewConnection(ent, trans);
if (NS_SUCCEEDED(rv)) {
// this function returns NOT_AVAILABLE for asynchronous connects
-@@ -1510,17 +1578,16 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
+@@ -1510,17 +1586,16 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
return rv;
}
}
@@ -377,11 +385,11 @@ index 133c301..872d505 100644
- }
-
- // step 6
-+ // step 6: Queue it
++ // step 5: Queue it
return NS_ERROR_NOT_AVAILABLE; /* queue it */
}
-@@ -1590,10 +1657,20 @@ nsHttpConnectionMgr::DispatchAbstractTransaction(nsConnectionEntry *ent,
+@@ -1590,10 +1665,20 @@ nsHttpConnectionMgr::DispatchAbstractTransaction(nsConnectionEntry *ent,
if (!NS_SUCCEEDED(rv))
return rv;
transaction = pipeline;
@@ -402,7 +410,7 @@ index 133c301..872d505 100644
}
nsRefPtr<nsConnectionHandle> handle = new nsConnectionHandle(conn);
-@@ -1692,27 +1769,15 @@ nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans)
+@@ -1692,27 +1777,15 @@ nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans)
"Sticky Connection Not In Active List");
trans->SetConnection(nullptr);
rv = DispatchTransaction(ent, trans, conn);
@@ -433,7 +441,7 @@ index 133c301..872d505 100644
}
-@@ -2311,13 +2376,37 @@ nsHttpConnectionMgr::OnMsgSpeculativeConnect(int32_t, void *param)
+@@ -2311,13 +2384,37 @@ nsHttpConnectionMgr::OnMsgSpeculativeConnect(int32_t, void *param)
if (preferredEntry)
ent = preferredEntry;
@@ -472,21 +480,22 @@ index 133c301..872d505 100644
nsHttpConnectionMgr::nsConnectionHandle::IsPersistent()
{
return mConn->IsPersistent();
-@@ -2852,9 +2941,12 @@ nsConnectionEntry::nsConnectionEntry(nsHttpConnectionInfo *ci)
+@@ -2852,9 +2949,13 @@ nsConnectionEntry::nsConnectionEntry(nsHttpConnectionInfo *ci)
{
NS_ADDREF(mConnInfo);
if (gHttpHandler->GetPipelineAggressive()) {
- mGreenDepth = kPipelineUnlimited;
-+ // Randomize the pipeline depth (3..32)
++ // Randomize the pipeline depth (3..12)
+ mGreenDepth = gHttpHandler->GetMaxOptimisticPipelinedRequests()
-+ + rand() % gHttpHandler->GetMaxPipelinedRequests();
++ + rand() % (gHttpHandler->GetMaxPipelinedRequests()
++ - gHttpHandler->GetMaxOptimisticPipelinedRequests());
mPipelineState = PS_GREEN;
}
+
mInitialGreenDepth = mGreenDepth;
memset(mPipeliningClassPenalty, 0, sizeof(int16_t) * nsAHttpTransaction::CLASS_MAX);
}
-@@ -2892,8 +2984,9 @@ nsConnectionEntry::OnPipelineFeedbackInfo(
+@@ -2892,8 +2993,9 @@ nsConnectionEntry::OnPipelineFeedbackInfo(
LOG(("Transaction completed at pipeline depth of %d. Host = %s\n",
depth, mConnInfo->Host()));
@@ -498,7 +507,7 @@ index 133c301..872d505 100644
}
nsAHttpTransaction::Classifier classification;
-@@ -2921,6 +3014,11 @@ nsConnectionEntry::OnPipelineFeedbackInfo(
+@@ -2921,6 +3023,11 @@ nsConnectionEntry::OnPipelineFeedbackInfo(
mPipelineState, mConnInfo->Host()));
mPipelineState = PS_RED;
mPipeliningPenalty = 0;
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits