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

Create RFC for programs to reduce their in memory usage #1884

Closed
aeyakovenko opened this issue Nov 21, 2018 · 2 comments
Closed

Create RFC for programs to reduce their in memory usage #1884

aeyakovenko opened this issue Nov 21, 2018 · 2 comments

Comments

@aeyakovenko
Copy link
Member

aeyakovenko commented Nov 21, 2018

Problem

Result of discussion in #1868

Programs that store state on chain take up RAM in solana. This RAM is fully replicated through all the validators that are validating the ledger. Because it is fully replicated, it is expensive. We need a design for reducing the cost of storing the state in RAM.

Challenges

The Account userdata that is owned by the program memory can't change unless it is by the program code only. The user can't spend the Account's coins to 0 unless the program allows it, and that would be in that Program's specific state transition.

Proposed Solution

This RFC needs to define way for the Program to reduce an Account's userdata to a hash (some fingerprint) of the userdata, and to restore the state that matches that hash (fingerprint) back into the same Account's userdata. To actually get some savings out of this the OS would need to provide a way for the Program to set the "used size" of the userdata vector. Then the OS can "resize" the vector and store fewer bits in memory.

@garious
Copy link
Contributor

garious commented Nov 22, 2018

I wonder if it'd be sufficient to simply move userdata into a different data structure in the bank, so that the validator can swap it to disk.

@aeyakovenko
Copy link
Member Author

aeyakovenko commented Nov 22, 2018

@garious A local disk swap is still fully replicated state. Should we call it FRS instead of RAM?

@mvines mvines added this to the v0.12 Beacons milestone Dec 6, 2018
@garious garious modified the milestones: v0.12 Beacons, v0.13 Grandview Jan 8, 2019
@garious garious closed this as completed Apr 4, 2019
HaoranYi added a commit to HaoranYi/solana that referenced this issue Jun 27, 2024
…olana-labs#1884)

* report num dups in shrinking

* pr changes

---------

Co-authored-by: HaoranYi <[email protected]>
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

No branches or pull requests

3 participants