From b68a66928c7b6d3b9040980bfa793509a72f7cc5 Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Fri, 22 Apr 2022 21:29:48 -0700 Subject: [PATCH] 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 18235067af9f5e6cd226c9f044f65d50254097da. This commit further adjusts some tunables so as to increase the aggressiveness of the ledger acquisition engine. --- src/ripple/app/ledger/impl/InboundLedger.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ripple/app/ledger/impl/InboundLedger.cpp b/src/ripple/app/ledger/impl/InboundLedger.cpp index d24c451a1..3ecba97b1 100644 --- a/src/ripple/app/ledger/impl/InboundLedger.cpp +++ b/src/ripple/app/ledger/impl/InboundLedger.cpp @@ -44,27 +44,27 @@ using namespace std::chrono_literals; enum { // Number of peers to start with - peerCountStart = 4 + peerCountStart = 5 // Number of peers to add on a timeout , - peerCountAdd = 2 + peerCountAdd = 3 // how many timeouts before we give up , - ledgerTimeoutRetriesMax = 10 + ledgerTimeoutRetriesMax = 6 // how many timeouts before we get aggressive , - ledgerBecomeAggressiveThreshold = 6 + ledgerBecomeAggressiveThreshold = 4 // Number of nodes to find initially , - missingNodesFind = 512 + missingNodesFind = 256 // Number of nodes to request for a reply , - reqNodesReply = 256 + reqNodesReply = 128 // Number of nodes to request blindly , @@ -72,7 +72,7 @@ enum { }; // millisecond for each ledger timeout -auto constexpr ledgerAcquireTimeout = 2500ms; +auto constexpr ledgerAcquireTimeout = 3000ms; InboundLedger::InboundLedger( Application& app, @@ -664,15 +664,15 @@ InboundLedger::trigger(std::shared_ptr const& peer, TriggerReason reason) if (reason != TriggerReason::reply) { // If we're querying blind, don't query deep - tmGL.set_querydepth(1); + tmGL.set_querydepth(0); } else if (peer && peer->isHighLatency()) { // If the peer has high latency, query extra deep - tmGL.set_querydepth(3); + tmGL.set_querydepth(2); } else - tmGL.set_querydepth(2); + tmGL.set_querydepth(1); // Get the state data first because it's the most likely to be useful // if we wind up abandoning this fetch.