-
Notifications
You must be signed in to change notification settings - Fork 19
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
Stateful storage pov optimization #1757
Conversation
⏳ Running benchmarks and calculating weights. DO NOT MERGE! A new commit will be added upon completion... |
⏳ Running benchmarks and calculating weights. DO NOT MERGE! A new commit will be added upon completion... |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1757 +/- ##
==========================================
- Coverage 87.62% 87.60% -0.02%
==========================================
Files 52 52
Lines 4346 4339 -7
==========================================
- Hits 3808 3801 -7
Misses 538 538 ☔ View full report in Codecov by Sentry. |
✅ Finished running benchmarks. Updated weights have been committed to this PR branch in commit 18b7a8d. |
⏳ Running benchmarks and calculating weights. DO NOT MERGE! A new commit will be added upon completion... |
⏳ Running benchmarks and calculating weights. DO NOT MERGE! A new commit will be added upon completion... |
✅ Finished running benchmarks. Updated weights have been committed to this PR branch in commit 7994714. |
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.
Looks pretty good. A couple of questions:
- Do we really want to run all benchmarks? Seems like we could omit unrelated benchmark files.
- Am I reading it wrong, or did some of the weights in
stateful-storage
increase?
Yes we do since changing the
So PoV for all of them should be decreased. Please let me know which one you think increased more than regular benchmark fluctuations. |
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.
Non-blocking comments only -
I did not look through all of the weights files but I did look through about a dozen and yes it seems that those changes are within the normal fluctuation of actual weights and error margins, whereas PoV is dramatically reduced. I do wonder about the child trie estimate though, how did you come up with the estimate of 1M child tries and why do you think that is a good estimate?
Is there a drawback of giving enough ceiling for 10M tries i.e. would it be too costly to overestimate the PoV, so does it make more sense to increase only when needed?
The idea is that since child tries are different from regular StorageMaps in the sense that StorageMaps are bottom-heavy. Meaning, the number of nodes from Having the above explanation to make sure our PoV calculations are considering this fact we need to ensure that step # 1 of PoV calculations are going to consider the max number of existing child tries for benchmarks. Since on a balanced tree in substrate we will need to access Log16(
A number of things to consider
|
1 Million child trees was a guesstimate based on the number of users on chain. Considering we would need to update our benchmark params every 4-6 months if we reached that point can bump it along with other benchmark calculations like database access benchmarks and etc which should be based on the data inside merkle tree. |
OK, looking again it was just some of the reference times that increased, which is probably normal fluctuation. PoVs decreased significantly 👍🏻 |
Goal
The goal of this PR is to evaluate and minimize PoV consumption by
stateful-storage
pallet.Closes #1782
Discussion
additional-trie-layers
numberMaxItemizedPageSizeBytes
from 64KiB to around 10KiB (will allow around 292 of 32 bytes itemized public keys)Improvements
apply_item_actions
got reduced from 45KB to 15KBupsert
anddelete
pages got reduced from 12KB to 6KBFuture improvements
Checklist