Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: add config flag for ARL to count all messages #6168

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config/localTemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@ type Local struct {
// EnableTxBacklogAppRateLimiting controls if an app rate limiter should be attached to the tx backlog enqueue process
EnableTxBacklogAppRateLimiting bool `version[32]:"true"`

// TxBacklogAppRateLimitingCountERLDrops feeds messages dropped by the ERL congestion manager & rate limiter (enabled by
// EnableTxBacklogRateLimiting) to the app rate limiter (enabled by EnableTxBacklogAppRateLimiting), so that all TX messages
// are counted. This provides more accurate rate limiting for the app rate limiter, at the potential expense of additional
// deserialization overhead.
TxBacklogAppRateLimitingCountERLDrops bool `version[35]:"false"`

// EnableTxBacklogRateLimiting controls if a rate limiter and congestion manager should be attached to the tx backlog enqueue process
// if enabled, the over-all TXBacklog Size will be larger by MAX_PEERS*TxBacklogReservedCapacityPerPeer
EnableTxBacklogRateLimiting bool `version[27]:"false" version[30]:"true"`
Expand Down
1 change: 1 addition & 0 deletions config/local_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ var defaultLocal = Local{
TrackerDBDir: "",
TransactionSyncDataExchangeRate: 0,
TransactionSyncSignificantMessageThreshold: 0,
TxBacklogAppRateLimitingCountERLDrops: false,
TxBacklogAppTxPerSecondRate: 100,
TxBacklogAppTxRateLimiterMaxSize: 1048576,
TxBacklogRateLimitingCongestionPct: 50,
Expand Down
8 changes: 8 additions & 0 deletions data/txHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
erl *util.ElasticRateLimiter
appLimiter *appRateLimiter
appLimiterBacklogThreshold int
appLimiterCountERLDrops bool

// batchVerifier provides synchronous verification of transaction groups, used only by pubsub validation in validateIncomingTxMessage.
batchVerifier verify.TxnGroupBatchSigVerifier
Expand Down Expand Up @@ -209,6 +210,7 @@
)
// set appLimiter triggering threshold at 50% of the base backlog size
handler.appLimiterBacklogThreshold = int(float64(opts.Config.TxBacklogSize) * float64(opts.Config.TxBacklogRateLimitingCongestionPct) / 100)
handler.appLimiterCountERLDrops = opts.Config.TxBacklogAppRateLimitingCountERLDrops
}
}

Expand Down Expand Up @@ -743,6 +745,12 @@
}()

if shouldDrop {
if handler.appLimiterCountERLDrops {

Check warning on line 748 in data/txHandler.go

View check run for this annotation

Codecov / codecov/patch

data/txHandler.go#L748

Added line #L748 was not covered by tests
// decode and let ARL count this txgroup, even though ERL is dropping it
if unverifiedTxGroup, _, invalid := decodeMsg(rawmsg.Data); !invalid {
handler.incomingTxGroupAppRateLimit(unverifiedTxGroup, rawmsg.Sender)

Check warning on line 751 in data/txHandler.go

View check run for this annotation

Codecov / codecov/patch

data/txHandler.go#L750-L751

Added lines #L750 - L751 were not covered by tests
}
}
// this TX message was rate-limited by ERL
return network.OutgoingMessage{Action: network.Ignore}
}
Expand Down
1 change: 1 addition & 0 deletions installer/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
"TrackerDBDir": "",
"TransactionSyncDataExchangeRate": 0,
"TransactionSyncSignificantMessageThreshold": 0,
"TxBacklogAppRateLimitingCountERLDrops": false,
"TxBacklogAppTxPerSecondRate": 100,
"TxBacklogAppTxRateLimiterMaxSize": 1048576,
"TxBacklogRateLimitingCongestionPct": 50,
Expand Down
1 change: 1 addition & 0 deletions test/testdata/configs/config-v35.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
"TrackerDBDir": "",
"TransactionSyncDataExchangeRate": 0,
"TransactionSyncSignificantMessageThreshold": 0,
"TxBacklogAppRateLimitingCountERLDrops": false,
"TxBacklogAppTxPerSecondRate": 100,
"TxBacklogAppTxRateLimiterMaxSize": 1048576,
"TxBacklogRateLimitingCongestionPct": 50,
Expand Down
Loading