diff --git a/cfg/rippled-example.cfg b/cfg/rippled-example.cfg index 907eb0eef0..9f9fb67e91 100644 --- a/cfg/rippled-example.cfg +++ b/cfg/rippled-example.cfg @@ -453,6 +453,13 @@ # # # +# [max_transactions] +# +# Configure the maximum number of transactions to have in the job queue +# +# Must be a number between 100 and 1000, defaults to 250 +# +# # [overlay] # # Controls settings related to the peer to peer overlay. diff --git a/src/ripple/core/Config.h b/src/ripple/core/Config.h index 4bf26a6141..26e18cbdbf 100644 --- a/src/ripple/core/Config.h +++ b/src/ripple/core/Config.h @@ -173,6 +173,11 @@ public: // Compression bool COMPRESSION = false; + // Work queue limits + int MAX_TRANSACTIONS = 250; + static constexpr int MAX_JOB_QUEUE_TX = 1000; + static constexpr int MIN_JOB_QUEUE_TX = 100; + // Amendment majority time std::chrono::seconds AMENDMENT_MAJORITY_TIME = defaultAmendmentMajorityTime; diff --git a/src/ripple/core/ConfigSections.h b/src/ripple/core/ConfigSections.h index a3c7b57414..c7467d032f 100644 --- a/src/ripple/core/ConfigSections.h +++ b/src/ripple/core/ConfigSections.h @@ -62,6 +62,7 @@ struct ConfigSection #define SECTION_IPS "ips" #define SECTION_IPS_FIXED "ips_fixed" #define SECTION_LEDGER_HISTORY "ledger_history" +#define SECTION_MAX_TRANSACTIONS "max_transactions" #define SECTION_NETWORK_QUORUM "network_quorum" #define SECTION_NODE_SEED "node_seed" #define SECTION_NODE_SIZE "node_size" diff --git a/src/ripple/core/impl/Config.cpp b/src/ripple/core/impl/Config.cpp index bdaa47b28e..63c6a8ed3a 100644 --- a/src/ripple/core/impl/Config.cpp +++ b/src/ripple/core/impl/Config.cpp @@ -488,6 +488,14 @@ Config::loadFromString(std::string const& fileContents) REDUCE_RELAY_SQUELCH = sec.value_or("squelch", false); } + if (getSingleSection(secConfig, SECTION_MAX_TRANSACTIONS, strTemp, j_)) + { + MAX_TRANSACTIONS = std::clamp( + beast::lexicalCastThrow(strTemp), + MIN_JOB_QUEUE_TX, + MAX_JOB_QUEUE_TX); + } + if (getSingleSection( secConfig, SECTION_AMENDMENT_MAJORITY_TIME, strTemp, j_)) { diff --git a/src/ripple/overlay/impl/PeerImp.cpp b/src/ripple/overlay/impl/PeerImp.cpp index 3e0c1ae26c..b2b1a8145b 100644 --- a/src/ripple/overlay/impl/PeerImp.cpp +++ b/src/ripple/overlay/impl/PeerImp.cpp @@ -1512,9 +1512,8 @@ PeerImp::onMessage(std::shared_ptr const& m) } } - // The maximum number of transactions to have in the job queue. - constexpr int max_transactions = 250; - if (app_.getJobQueue().getJobCount(jtTRANSACTION) > max_transactions) + if (app_.getJobQueue().getJobCount(jtTRANSACTION) > + app_.config().MAX_TRANSACTIONS) { overlay_.incJqTransOverflow(); JLOG(p_journal_.info()) << "Transaction queue is full";