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

Limit the number of buckets in verifiedTransactionCache to 3 #2775

Merged
merged 1 commit into from
Aug 20, 2021

Conversation

tolikzinovyev
Copy link
Contributor

Summary

The number of buckets in verifiedTransactionCache can be arbitrarily large depending on the requested cache size, and each lookup in the cache does that many map lookups. This PR limits the number of buckets to 3. Now, the lookup takes at most 3 lookups and the size overhead is 1.5.

Test Plan

Modified existing unit tests.

@codecov-commenter
Copy link

codecov-commenter commented Aug 19, 2021

Codecov Report

Merging #2775 (414d931) into master (8ef8821) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2775      +/-   ##
==========================================
- Coverage   47.10%   47.07%   -0.04%     
==========================================
  Files         349      349              
  Lines       56352    56352              
==========================================
- Hits        26543    26526      -17     
- Misses      26836    26848      +12     
- Partials     2973     2978       +5     
Impacted Files Coverage Δ
data/transactions/verify/verifiedTxnCache.go 77.55% <100.00%> (ø)
crypto/merkletrie/trie.go 66.42% <0.00%> (-2.19%) ⬇️
crypto/merkletrie/node.go 91.62% <0.00%> (-1.87%) ⬇️
ledger/blockqueue.go 82.18% <0.00%> (-1.73%) ⬇️
catchup/peerSelector.go 98.95% <0.00%> (-1.05%) ⬇️
catchup/service.go 68.57% <0.00%> (-0.78%) ⬇️
network/wsPeer.go 75.20% <0.00%> (-0.28%) ⬇️
ledger/acctupdates.go 62.46% <0.00%> (-0.09%) ⬇️
network/wsNetwork.go 60.92% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ef8821...414d931. Read the comment docs.

@tsachiherman
Copy link
Contributor

could you take a look to see why it's failing on travis ?

@tolikzinovyev
Copy link
Contributor Author

Flaky tests I guess. I restarted the job.

@tolikzinovyev
Copy link
Contributor Author

Passed now!

@tsachiherman tsachiherman merged commit 153e97b into algorand:master Aug 20, 2021
@tolikzinovyev tolikzinovyev deleted the txn-cache branch January 6, 2022 21:37
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