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

AcctIdx: move zero lamport out of accounts index #21526

Merged
merged 1 commit into from
Dec 14, 2021

Conversation

jeffwashington
Copy link
Contributor

@jeffwashington jeffwashington commented Dec 1, 2021

Problem

Lamport balance in account index is an optimization for shrinking (maybe also cleaning). But, this information already exists in the code path that produces lists of pubkeys.
Thus, lamports in the accounts index require the accounts index entries to be larger. Larger means more space in memory, less cache hits, more size on disk, more pages needing to map in, etc. These issues become worse with disk buckets and 10B accounts.

Summary of Changes

Remove lamports from an AccountsIndex entry for perf.
Note that the first attempt was trying to calculate the zero lamport information in clean and shrink. This proved to be difficult with deferred dirty keys.
Fixes #

runtime/src/accounts_db.rs Outdated Show resolved Hide resolved
runtime/src/accounts_db.rs Outdated Show resolved Hide resolved
runtime/src/accounts_db.rs Outdated Show resolved Hide resolved
runtime/src/accounts_db.rs Outdated Show resolved Hide resolved
@jeffwashington jeffwashington force-pushed the metrics17 branch 5 times, most recently from 599ac3e to 4e2fc3f Compare December 13, 2021 18:43
brooksprumo
brooksprumo previously approved these changes Dec 13, 2021
Copy link
Contributor

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

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

lgtm

Comment on lines +1 to +4
//! AccountInfo represents a reference to AccountSharedData in either an AppendVec or the write cache.
//! AccountInfo is not persisted anywhere between program runs.
//! AccountInfo is purely runtime state.
//! Note that AccountInfo is saved to disk buckets during runtime, but disk buckets are recreated at startup.
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the doc comments!

@codecov
Copy link

codecov bot commented Dec 13, 2021

Codecov Report

Merging #21526 (1477b5f) into master (a400b5e) will decrease coverage by 0.0%.
The diff coverage is 80.8%.

@@            Coverage Diff            @@
##           master   #21526     +/-   ##
=========================================
- Coverage    81.3%    81.3%   -0.1%     
=========================================
  Files         516      516             
  Lines      144033   144192    +159     
=========================================
+ Hits       117139   117230     +91     
- Misses      26894    26962     +68     

@jeffwashington jeffwashington marked this pull request as ready for review December 13, 2021 22:52
@mergify mergify bot dismissed brooksprumo’s stale review December 13, 2021 23:58

Pull request has been modified.

@jeffwashington jeffwashington merged commit a86fe89 into solana-labs:master Dec 14, 2021
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.

3 participants