From 2d510704f08245e14d9c761a4c022f82e220c5d9 Mon Sep 17 00:00:00 2001 From: Brian Olson Date: Tue, 9 Aug 2022 16:33:32 -0400 Subject: [PATCH] make txBacklogSize responsive to block size (#4377) --- data/txHandler.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/txHandler.go b/data/txHandler.go index 9bc91203ad..46248b4edb 100644 --- a/data/txHandler.go +++ b/data/txHandler.go @@ -23,6 +23,7 @@ import ( "io" "sync" + "github.com/algorand/go-algorand/config" "github.com/algorand/go-algorand/crypto" "github.com/algorand/go-algorand/data/bookkeeping" "github.com/algorand/go-algorand/data/pools" @@ -38,7 +39,8 @@ import ( // The size txBacklogSize used to determine the size of the backlog that is used to store incoming transaction messages before starting dropping them. // It should be configured to be higher then the number of CPU cores, so that the execution pool get saturated, but not too high to avoid lockout of the // execution pool for a long duration of time. -const txBacklogSize = 1000 +// Set backlog at 'approximately one block' by dividing block size by a typical transaction size. +var txBacklogSize = config.Consensus[protocol.ConsensusCurrentVersion].MaxTxnBytesPerBlock / 200 var transactionMessagesHandled = metrics.MakeCounter(metrics.TransactionMessagesHandled) var transactionMessagesDroppedFromBacklog = metrics.MakeCounter(metrics.TransactionMessagesDroppedFromBacklog)