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

[Merged by Bors] - datastore: parametrize and increase cache size #4882

Closed
wants to merge 3 commits into from

Conversation

dshulyak
Copy link
Contributor

@dshulyak dshulyak commented Aug 21, 2023

tried to sync node and noticed that it spends a lot of time looping over activeset in eligibility validation. i will open an issue to optimize that code path, but for now we need to increase number of activations stored in cache.

related: #4883

@codecov
Copy link

codecov bot commented Aug 21, 2023

Codecov Report

Merging #4882 (2abb0f8) into develop (b23bc52) will decrease coverage by 0.1%.
Report is 1 commits behind head on develop.
The diff coverage is 79.4%.

@@            Coverage Diff            @@
##           develop   #4882     +/-   ##
=========================================
- Coverage     76.8%   76.8%   -0.1%     
=========================================
  Files          261     261             
  Lines        30160   30251     +91     
=========================================
+ Hits         23189   23247     +58     
- Misses        5476    5504     +28     
- Partials      1495    1500      +5     
Files Changed Coverage Δ
p2p/peer.go 100.0% <ø> (ø)
p2p/host.go 38.8% <64.7%> (+1.0%) ⬆️
p2p/upgrade.go 66.4% <75.0%> (+2.2%) ⬆️
api/grpcserver/admin_service.go 66.6% <76.6%> (+3.3%) ⬆️
api/grpcserver/grpc.go 72.7% <100.0%> (-14.8%) ⬇️
config/config.go 100.0% <100.0%> (ø)
config/mainnet.go 95.6% <100.0%> (+<0.1%) ⬆️
datastore/store.go 69.8% <100.0%> (+1.9%) ⬆️
node/node.go 64.8% <100.0%> (-0.1%) ⬇️

... and 7 files with indirect coverage changes

if err != nil {
lg.Fatal("failed to create atx cache", err)
}

malfeasanceCache, err := lru.New[types.NodeID, *types.MalfeasanceProof](malfeasanceCacheSize)
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the malfeasanceCacheSize constant can be removed.

// NewCachedDB create an instance of a CachedDB.
func NewCachedDB(db *sql.Database, lg log.Log) *CachedDB {
atxHdrCache, err := lru.New[types.ATXID, *types.ActivationTxHeader](atxHdrCacheSize)
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that atxHdrCacheSize is still used but only for the vrfNonceCache, so it could be renamed.

Copy link
Contributor

@piersy piersy left a comment

Choose a reason for hiding this comment

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

Two small points, otherwise looks good!

@dshulyak
Copy link
Contributor Author

thanks, i removed both constants, and using ATXSize for vrf nonce too

@dshulyak
Copy link
Contributor Author

bors merge

bors bot pushed a commit that referenced this pull request Aug 21, 2023
tried to sync node and noticed that it spends a lot of time looping over activeset in eligibility validation. i will open an issue to optimize that code path, but for now we need to increase number of activations stored in cache.

related: #4883
@bors
Copy link

bors bot commented Aug 21, 2023

Pull request successfully merged into develop.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title datastore: parametrize and increase cache size [Merged by Bors] - datastore: parametrize and increase cache size Aug 21, 2023
@bors bors bot closed this Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants