Adjust the aggressiveness of the ledger acquisition engine:

Several hard-coded parameters control the behavior of the ledger
acquisition engine. The values of many of these parameters where
set by intuition and have complex and non-intuitive interactions
with each other and other parts of the code.

An earlier commit attempted to adjust several of these parameters
to improve syncing performance; initial testing was promising but
a number of operators reported experiencing syncing and stability
issues with their servers. As a result, this commit reverts parts
of commit 18235067af.

This commit further adjusts some tunables so as to increase the
aggressiveness of the ledger acquisition engine.
This commit is contained in:
Nik Bougalis
2022-04-22 21:29:48 -07:00
parent 245174c42c
commit b68a66928c

View File

@@ -44,27 +44,27 @@ using namespace std::chrono_literals;
enum { enum {
// Number of peers to start with // Number of peers to start with
peerCountStart = 4 peerCountStart = 5
// Number of peers to add on a timeout // Number of peers to add on a timeout
, ,
peerCountAdd = 2 peerCountAdd = 3
// how many timeouts before we give up // how many timeouts before we give up
, ,
ledgerTimeoutRetriesMax = 10 ledgerTimeoutRetriesMax = 6
// how many timeouts before we get aggressive // how many timeouts before we get aggressive
, ,
ledgerBecomeAggressiveThreshold = 6 ledgerBecomeAggressiveThreshold = 4
// Number of nodes to find initially // Number of nodes to find initially
, ,
missingNodesFind = 512 missingNodesFind = 256
// Number of nodes to request for a reply // Number of nodes to request for a reply
, ,
reqNodesReply = 256 reqNodesReply = 128
// Number of nodes to request blindly // Number of nodes to request blindly
, ,
@@ -72,7 +72,7 @@ enum {
}; };
// millisecond for each ledger timeout // millisecond for each ledger timeout
auto constexpr ledgerAcquireTimeout = 2500ms; auto constexpr ledgerAcquireTimeout = 3000ms;
InboundLedger::InboundLedger( InboundLedger::InboundLedger(
Application& app, Application& app,
@@ -664,15 +664,15 @@ InboundLedger::trigger(std::shared_ptr<Peer> const& peer, TriggerReason reason)
if (reason != TriggerReason::reply) if (reason != TriggerReason::reply)
{ {
// If we're querying blind, don't query deep // If we're querying blind, don't query deep
tmGL.set_querydepth(1); tmGL.set_querydepth(0);
} }
else if (peer && peer->isHighLatency()) else if (peer && peer->isHighLatency())
{ {
// If the peer has high latency, query extra deep // If the peer has high latency, query extra deep
tmGL.set_querydepth(3); tmGL.set_querydepth(2);
} }
else else
tmGL.set_querydepth(2); tmGL.set_querydepth(1);
// Get the state data first because it's the most likely to be useful // Get the state data first because it's the most likely to be useful
// if we wind up abandoning this fetch. // if we wind up abandoning this fetch.