-
Notifications
You must be signed in to change notification settings - Fork 310
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
Don't load executable accounts for transactions #180
base: master
Are you sure you want to change the base?
Conversation
fd06abf
to
e834852
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #180 +/- ##
========================================
Coverage 81.9% 81.9%
========================================
Files 837 837
Lines 226823 227064 +241
========================================
+ Hits 185828 186091 +263
+ Misses 40995 40973 -22 |
b162f7b
to
2016e3a
Compare
Can you rebase it onto master and resolve the conflicts? |
7175ff1
to
45a967b
Compare
It's been rebased |
45a967b
to
5c34e3c
Compare
I only skimmed through the changes haven't done a proper review, but here's some initial comments since this ties to another perf issue I've been investigating.
Anyway, what brought me here is that I've been investigating account_matches_owners interacting with the accounts-db read cache, and causing a lot of major page faults (hitting disk). I think the original approach of having separate filter_executable_program_accounts/load_accounts is not ideal. We introduced account_matches_owners() to "peek" into the accounts-db before we load the non-executable accounts, which effectively forces us to do two round trips into the accountsdb. We first make accounts-db iterate over all accounts in a message, then do another round trip where we make it iterate over all the non-executable accounts. account_matches_owners() interacts with the internal caches in the accountsdb, pages in parts of the accounts index, pages in parts of appendvecs, etc, so this is not great perf wise. Instead, I think we could have a load_accounts_with_filter(account_keys, |...| { ... }) and in the filter build the list of program accounts, and return a value to signal to the accounts-db to not load nor insert an account into its caches. What do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which SIMDs do these feature gates implement?
@@ -785,6 +785,14 @@ pub mod deprecate_unused_legacy_vote_plumbing { | |||
solana_sdk::declare_id!("6Uf8S75PVh91MYgPQSHnjRAPQq6an5BDv9vomrCwDqLe"); | |||
} | |||
|
|||
pub mod dont_load_executable_accounts { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please don't introduce two feature gates in the same pr. this is indicative of a change set that should be split up (as is the line change total)
That is because it is the first place to touch all the accounts of a TX. But I agree that |
Nope because account_matches_owners explicitly skips parts of the accounts-db cache (but not all)
It isn't because you still don't want executable accounts to occupy space in the cache if they're going to be cached elsewhere (the program cache). Since you never want load_accounts(executable) to cache, accounts-db needs to be directly involved, hence the load_accounts_with_filter() suggestion. |
I think we have roughly the same thing in mind. What I suggest is three phases:
Still leaves us with the original issue of instruction accounts in CPI that this PR is trying to solve.
Happens in phase 2.
Happens in phase 3. Another thing I noticed while tinkering on this is that |
It is not clear to me:
|
Have to check the interfaces if such a method exists already, don't know.
Agreed, we can also check the owner of the loaded accounts. |
I'm not sure that they are the same. Can you elaborate what's the advantage of doing this - which requires account_matches_owners which is inherently "look before you leap" - vs something like load_accounts_with_filter(), which would allow account_matches_owners to be removed altogether and do only one trip inside the accounts db, reducing locks, index lookups etc? if you do if !account_matches_owners(key, owners) { load_account(key) } that's more work than if you do load_accounts(account_keys, filter) and filter() is invoked with the account. First case you have to find the account twice, second case once. |
My proposal does not need to use What exactly is the purpose of the |
The Firedancer team maintains a line-for-line reimplementation of the |
Problem
There is no need for loading executable accounts for transactions, if the account is already present in the program cache.
Summary of Changes
Future:
Fixes #