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

txHandler: make dedup working set independent from ERL #5200

Merged
merged 2 commits into from Mar 14, 2023

Conversation

algorandskiy
Copy link
Contributor

@algorandskiy algorandskiy commented Mar 13, 2023

Summary

Fine tuning ERL might affect the dedup working set size in a negative way. This PR fixes that.
Additionally, make dedup creation optional (only if enabled). This is not important but looks a right thing to do.
Plus couple non-related small comment/assert noted along the way.

Test Plan

Existing tests

@codecov
Copy link

codecov bot commented Mar 13, 2023

Codecov Report

Merging #5200 (31cf4b8) into master (c556cfc) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #5200      +/-   ##
==========================================
- Coverage   53.57%   53.56%   -0.01%     
==========================================
  Files         441      441              
  Lines       55094    55098       +4     
==========================================
- Hits        29515    29513       -2     
+ Misses      23300    23296       -4     
- Partials     2279     2289      +10     
Impacted Files Coverage Δ
config/config.go 50.00% <ø> (ø)
data/txHandler.go 72.40% <100.00%> (+0.33%) ⬆️

... and 10 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

cacheConfig: txHandlerConfig{opts.Config.TxFilterRawMsgEnabled(), opts.Config.TxFilterCanonicalEnabled()},
streamVerifierChan: make(chan execpool.InputJob),
streamVerifierDropped: make(chan *verify.UnverifiedTxnSigJob),
}

// use defaultBacklogSize = approx number of txns in a full block as a parameter for the dedup cache size
defaultBacklogSize := config.GetDefaultLocal().TxBacklogSize
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why config.GetDefaultLocal().TxBacklogSize and not opts.Config.TxBacklogSize?

This function is now juggling with 3 different backlog size concepts:

  1. defaultBacklogSize := config.GetDefaultLocal().TxBacklogSize
  2. defaultBacklogSize := opts.Config.TxBacklogSize
  3. txBacklogSize += (opts.Config.IncomingConnectionsLimit * opts.Config.TxBacklogReservedCapacityPerPeer)

Although (2) is not used in that form, but used as (3), (1) and (3) may or may not always originate from the same value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config.GetDefaultLocal().TxBacklogSize returns real default and opts.Config.TxBacklogSize returns actual value and they could be different (that's where the issue comes from)

// use defaultBacklogSize = approx number of txns in a full block as a parameter for the dedup cache size
defaultBacklogSize := config.GetDefaultLocal().TxBacklogSize
if handler.cacheConfig.enableFilteringRawMsg {
handler.msgCache = makeSaltedCache(2 * defaultBacklogSize)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was understandable to have the size of msgCache and txCanonicalCache to be the same as backlogQueue size.
After all, no regression was observed when the cache sizes were set to the queue sizes.

But now, ERL changes the queue and cache sizes, we get regression, and the fix is reverting the cache sizes but not the queue sizes.
What is the justification for the ERL imposed size, and consequently, the separation of the cache sizes from the queue sizes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decreasing sets size triggers rotation faster => higher chances pass a dup msg seen say 10 seconds ago

data/txHandler.go Show resolved Hide resolved
data/txHandler.go Outdated Show resolved Hide resolved
data/txHandler.go Outdated Show resolved Hide resolved
Copy link
Contributor

@algonautshant algonautshant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is addressing a fallout from a different parameter change. This PR is fine.

I am worried that too many parameters are controlling the critical pipeline of txn verification, and this will have adverse effects on the overall performance. This is out of the scope of this PR.

@algorandskiy
Copy link
Contributor Author

Thank you folks for looking into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants