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

[Feature (collections)]: decoded object cache #19223

Open
tac0turtle opened this issue Jan 24, 2024 · 3 comments
Open

[Feature (collections)]: decoded object cache #19223

tac0turtle opened this issue Jan 24, 2024 · 3 comments

Comments

@tac0turtle
Copy link
Member

Summary

As we deprecate the context due to the design of server/v2 we will need modules to fetch data from the consensus module if they need the consensus params. this poises an new overhead.

Problem Definition

Asking users to fetch data from other modules means there is another layer of decoding needing to happen. In the case of context params they would need to fetch it from consensus, while it may already be in the cache, it will need to be decoded each time.

Proposed Feature

Add a way object cache to be used with collections so items that are repeatedly fetched from other modules will be stored in this cache already decoded. The cache would need to be flushed upon every write.

This is somewhat similar to interblock cache except, the change is that the values will already be decoded. We should avoid doing this for all state but for values that are touched repeatedly in a block this would reduce the over head.

Future Optimisations: If we have a way to prefetch keys from store we could decode them ahead of time there fore reducing the total time of execution by avoiding the fetch and decode in the execution path.

@alexanderbez
Copy link
Contributor

If I'm reading this correctly, the proposal is to have an (unlimited sized) cache that stores typed objects (collections) and will be purged/cleared at the end of every block, right?

@tac0turtle
Copy link
Member Author

tac0turtle commented Jan 24, 2024

yea something like that. the application dev should make the decision to cache it or not. Ideally its not automatic

@tac0turtle
Copy link
Member Author

we should look at how cronos does it and implemnt the same for store v2 crypto-org-chain#206

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants