mirror of
				https://github.com/Xahau/xahaud.git
				synced 2025-11-04 10:45:50 +00:00 
			
		
		
		
	Make the transaction job queue limit adjustable:
The job queue can impose limits of how many jobs of a particular type can be queued. This commit makes the previously hard-coded limit associated with transactions configurable by the server's operator. Servers that have increased memory capacity or which expect to see an influx of transactions can increase the number of transactions their server will be able to queue. This commit fixes #3556.
This commit is contained in:
		
				
					committed by
					
						
						Nik Bougalis
					
				
			
			
				
	
			
			
			
						parent
						
							b1d47c65d4
						
					
				
				
					commit
					660d9c1602
				
			@@ -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.
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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"
 | 
			
		||||
 
 | 
			
		||||
@@ -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<int>(strTemp),
 | 
			
		||||
            MIN_JOB_QUEUE_TX,
 | 
			
		||||
            MAX_JOB_QUEUE_TX);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (getSingleSection(
 | 
			
		||||
            secConfig, SECTION_AMENDMENT_MAJORITY_TIME, strTemp, j_))
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -1512,9 +1512,8 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMTransaction> 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";
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user