From ea24e8ad1d3e11462e071e62ce1a2a86fab08367 Mon Sep 17 00:00:00 2001 From: Matt Joras Date: Thu, 6 Mar 2025 16:09:19 -0800 Subject: [PATCH] Remove spdyMode from HTTP2PriorityQueue Summary: Not used. Reviewed By: hanidamlaj Differential Revision: D70569309 fbshipit-source-id: be206ae54dc0fef828cfb5931df3ba9121b7b770 --- .../lib/http/session/HTTP2PriorityQueue.cpp | 15 +---------- .../lib/http/session/HTTP2PriorityQueue.h | 2 +- proxygen/lib/http/session/HTTPSession.cpp | 2 +- .../session/test/HTTP2PriorityQueueTest.cpp | 27 ++----------------- 4 files changed, 5 insertions(+), 41 deletions(-) diff --git a/proxygen/lib/http/session/HTTP2PriorityQueue.cpp b/proxygen/lib/http/session/HTTP2PriorityQueue.cpp index f291fcb18..f4c60b4c5 100644 --- a/proxygen/lib/http/session/HTTP2PriorityQueue.cpp +++ b/proxygen/lib/http/session/HTTP2PriorityQueue.cpp @@ -643,7 +643,7 @@ bool HTTP2PriorityQueue::nextEgressResult(HTTP2PriorityQueue& queue, } void HTTP2PriorityQueue::nextEgress( - HTTP2PriorityQueue::NextEgressResult& result, bool spdyMode) { + HTTP2PriorityQueue::NextEgressResult& result) { struct WeightCmp { bool operator()(const std::pair& t1, const std::pair& t2) { @@ -671,19 +671,6 @@ void HTTP2PriorityQueue::nextEgress( } pendingNodes.pop_front(); } - // In SPDY mode, we stop as soon one level of the tree produces results, - // then normalize the ratios. - if (spdyMode && !result.empty() && !pendingNodesTmp.empty()) { - double totalRatio = 0; - for (auto& txnPair : result) { - totalRatio += txnPair.second; - } - CHECK_GT(totalRatio, 0); - for (auto& txnPair : result) { - txnPair.second = txnPair.second / totalRatio; - } - break; - } std::swap(pendingNodes, pendingNodesTmp); } while (!stop && !pendingNodes.empty()); std::sort(result.begin(), result.end(), WeightCmp()); diff --git a/proxygen/lib/http/session/HTTP2PriorityQueue.h b/proxygen/lib/http/session/HTTP2PriorityQueue.h index 06fc1c541..4406dcfb7 100644 --- a/proxygen/lib/http/session/HTTP2PriorityQueue.h +++ b/proxygen/lib/http/session/HTTP2PriorityQueue.h @@ -161,7 +161,7 @@ class HTTP2PriorityQueue : public HTTP2PriorityQueueBase { using NextEgressResult = std::vector>; - void nextEgress(NextEgressResult& result, bool spdyMode = false); + void nextEgress(NextEgressResult& result); static void setNodeLifetime(std::chrono::milliseconds lifetime) { kNodeLifetime_ = lifetime; diff --git a/proxygen/lib/http/session/HTTPSession.cpp b/proxygen/lib/http/session/HTTPSession.cpp index df8ae9c31..589d279fa 100644 --- a/proxygen/lib/http/session/HTTPSession.cpp +++ b/proxygen/lib/http/session/HTTPSession.cpp @@ -2179,7 +2179,7 @@ unique_ptr HTTPSession::getNextToSend(bool* cork, } toSend = std::min(toSend, connFlowControl_->getAvailableSend()); } - txnEgressQueue_.nextEgress(nextEgressResults_, false); + txnEgressQueue_.nextEgress(nextEgressResults_); CHECK(!nextEgressResults_.empty()); // Queue was non empty, so this must be // The maximum we will send for any transaction in this loop uint32_t txnMaxToSend = toSend * nextEgressResults_.front().second; diff --git a/proxygen/lib/http/session/test/HTTP2PriorityQueueTest.cpp b/proxygen/lib/http/session/test/HTTP2PriorityQueueTest.cpp index 5803af7ce..226c4aa1a 100644 --- a/proxygen/lib/http/session/test/HTTP2PriorityQueueTest.cpp +++ b/proxygen/lib/http/session/test/HTTP2PriorityQueueTest.cpp @@ -120,9 +120,9 @@ class QueueTest : public testing::Test { std::bind(&QueueTest::visitNode, this, _1, _2, _3, _4), stopFn, true); } - void nextEgress(bool spdyMode = false) { + void nextEgress() { HTTP2PriorityQueue::NextEgressResult nextEgressResults; - q_.nextEgress(nextEgressResults, spdyMode); + q_.nextEgress(nextEgressResults); nodes_.clear(); for (auto p : nextEgressResults) { nodes_.push_back(std::make_pair(getTxnID(p.first), p.second * 100)); @@ -685,29 +685,6 @@ TEST_F(QueueTest, ChromeTest) { } } -TEST_F(QueueTest, NextEgressSpdy) { - // 0 and 3 are vnodes representing pri 0 and 1 - addTransaction(0, {kRootNodeId, false, 0}, true); - addTransaction(3, {0, false, 0}, true); - - // 7 and 9 are pri 0, 11 and 13 are pri 1 - addTransaction(7, {0, false, 15}); - addTransaction(9, {0, false, 15}); - addTransaction(11, {3, false, 15}); - addTransaction(13, {3, false, 15}); - - nextEgress(true); - EXPECT_EQ(nodes_, IDList({{7, 50}, {9, 50}})); - - signalEgress(7, false); - nextEgress(true); - EXPECT_EQ(nodes_, IDList({{9, 100}})); - - signalEgress(9, false); - nextEgress(true); - EXPECT_EQ(nodes_, IDList({{11, 50}, {13, 50}})); -} - TEST_F(QueueTest, AddOrUpdate) { q_.addOrUpdatePriorityNode(0, {kRootNodeId, false, 15}); q_.addOrUpdatePriorityNode(3, {kRootNodeId, false, 15});